|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.post.storage.StorageService
public class StorageService
This class represents a service which stores data in PAST. This class supports two types of data: content-hash blocks and private-key signed blocks. This class will automatically format and store data, as well as retrieve and verify the stored data.
Field Summary | |
---|---|
static int |
MAX_CONTENT_HASH_SIZE
|
protected long |
timeoutInterval
The default timeout period of objects (3 weeks) |
Constructor Summary | |
---|---|
StorageService(Endpoint endpoint,
PostEntityAddress address,
Past immutablePast,
Past mutablePast,
IdFactory factory,
java.security.KeyPair keyPair,
long timeoutInterval)
Contructs a StorageService given a PAST to run on top of. |
Method Summary | |
---|---|
void |
backupLogs(PostLog log,
Log[] logs,
Continuation command)
This method backs up all of the provided logs by inserting them into the immutable store with appropriate version numbers. |
Id |
getRandomNodeId()
|
protected long |
getTimeout()
Internal method which returns what the timeout should be for an object inserted now. |
byte[][] |
partition(byte[] array)
Method which partitions a serialized object into acceptable size arrays - currently, it just splits the array into a bunch of arrays of size MAX_CONTENT_HASH_SIZE or less. |
static void |
recoverLogs(Id location,
long timestamp,
java.security.KeyPair keyPair,
Past immutablePast,
Past mutablePast,
Continuation command,
Environment env,
Logger logger)
This method performs an emergency recovery of the logs by reinserting them into the provided PAST store. |
void |
refreshContentHash(ContentHashReference[] references,
Continuation command)
This method "refreshes" a list of ContentHashReferences, which ensures that all of the referenced objects are not collected by the underlying store. |
void |
refreshSecure(SecureReference[] references,
Continuation command)
This method "refreshes" a list of SecureReferences, which ensures that all of the referenced objects are not collected by the underlying store. |
void |
retrieveAllSigned(SignedReference reference,
Continuation command)
This method retrieves a previously-stored block from PAST which was signed using the private key. |
void |
retrieveAndVerifySigned(SignedReference reference,
Continuation command)
This method retrieves a previously-stored private-key signed block from PAST. |
void |
retrieveAndVerifySigned(SignedReference reference,
java.security.PublicKey publicKey,
Continuation command)
This method retrieves a previously-stored block from PAST which was signed using the private key matching the given public key. |
void |
retrieveContentHash(ContentHashReference reference,
Continuation command)
This method retrieves a given PostDataReference object from the network. |
void |
retrieveContentHashEntry(Id location,
byte[] key,
Continuation command)
This method retrieves a single content hash entry and verifies it. |
void |
retrieveSecure(SecureReference reference,
Continuation command)
This method retrieves a given SecureReference object from the network. |
void |
retrieveSigned(SignedReference reference,
Continuation command)
This method retrieves a previously-stored block from PAST which was signed using the private key. |
void |
setAggregate(PostLog log,
Continuation command)
Method which sets the aggregate head, if we are using a Aggregation as the immutable past store. |
void |
storeContentHash(PostData data,
Continuation command)
Stores a PostData in the PAST storage system, in encrypted state, and returns a pointer and key to the data object. |
void |
storeContentHashEntry(byte[] plainText,
Continuation command)
Performs the actual content hashing and insertion of a single content has block. |
void |
storeSecure(PostData data,
Continuation command)
Stores a PostData in the PAST storage system, in encrypted state, and returns a pointer and key to the data object. |
void |
storeSigned(PostData data,
Id location,
Continuation command)
Stores a PostData in the PAST store by signing the content and storing it at a well-known location. |
protected static void |
storeSigned(PostData data,
Id location,
long time,
long expiration,
java.security.KeyPair keyPair,
Past past,
Continuation command)
Stores a PostData in the PAST store by signing the content and storing it at a well-known location. |
boolean |
verifySigned(PostData data,
java.security.PublicKey key)
This method verifies a signed block of data with the given public key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int MAX_CONTENT_HASH_SIZE
protected long timeoutInterval
Constructor Detail |
---|
public StorageService(Endpoint endpoint, PostEntityAddress address, Past immutablePast, Past mutablePast, IdFactory factory, java.security.KeyPair keyPair, long timeoutInterval)
past
- The PAST service to use.credentials
- Credentials to use to store data.keyPair
- The keypair to sign/verify data withMethod Detail |
---|
public Id getRandomNodeId()
protected long getTimeout()
public void storeContentHash(PostData data, Continuation command)
data
- The data to store.command
- The command to run once the store has completed.public byte[][] partition(byte[] array)
array
- the array
public void storeContentHashEntry(byte[] plainText, Continuation command)
data
- The data to store.command
- The command to run once the store has completed.public void retrieveContentHash(ContentHashReference reference, Continuation command)
reference
- The reference to the PostDataObjectcommand
- The command to run once the store has completed.public void retrieveContentHashEntry(Id location, byte[] key, Continuation command)
reference
- The reference to the PostDataObjectcommand
- The command to run once the store has completed.public void refreshContentHash(ContentHashReference[] references, Continuation command)
references
- The references to refreshcommand
- The command to run once donepublic void backupLogs(PostLog log, Log[] logs, Continuation command)
references
- The references to refreshcommand
- The command to run once donepublic static void recoverLogs(Id location, long timestamp, java.security.KeyPair keyPair, Past immutablePast, Past mutablePast, Continuation command, Environment env, Logger logger)
public void setAggregate(PostLog log, Continuation command)
log
- The log to set the aggregate inpublic void storeSigned(PostData data, Id location, Continuation command)
data
- The data to storelocation
- The location where to store the datacommand
- The command to run once the store has completed.protected static void storeSigned(PostData data, Id location, long time, long expiration, java.security.KeyPair keyPair, Past past, Continuation command)
data
- The data to storelocation
- The location where to store the datacommand
- The command to run once the store has completed.public void retrieveAndVerifySigned(SignedReference reference, Continuation command)
location
- The location of the datacommand
- The command to run once the store has completed.public void retrieveAndVerifySigned(SignedReference reference, java.security.PublicKey publicKey, Continuation command)
location
- The location of the datapublicKey
- The public key matching the private key used to sign the datacommand
- The command to run once the store has completed.public void retrieveSigned(SignedReference reference, Continuation command)
location
- The location of the datacommand
- The command to run once the store has completed.public void retrieveAllSigned(SignedReference reference, Continuation command)
location
- The location of the datacommand
- The command to run once the store has completed.public boolean verifySigned(PostData data, java.security.PublicKey key)
data
- The datakey
- The public key to verify the data against
public void storeSecure(PostData data, Continuation command)
data
- The data to store.command
- The command to run once the store has completed.public void retrieveSecure(SecureReference reference, Continuation command)
reference
- The reference to the PostDataObjectcommand
- The command to run once the store has completed.public void refreshSecure(SecureReference[] references, Continuation command)
references
- The references to refreshcommand
- The command to run once done
|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |