|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.persistence.MemoryStorage
public class MemoryStorage
This class is an implementation of Storage which provides in-memory storage. This class is specifically *NOT* designed to provide persistent storage, and simply functions as an enhanced hash table.
Constructor Summary | |
---|---|
MemoryStorage(IdFactory factory)
Builds a MemoryStorage object. |
Method Summary | |
---|---|
boolean |
exists(Id id)
Returns whether or not the provided id exists |
void |
flush(Continuation c)
Method which is used to erase all data stored in the Storage. |
java.io.Serializable |
getMetadata(Id id)
Returns the metadata associated with the provided object, or null if no metadata exists. |
void |
getObject(Id id,
Continuation c)
Returns the object identified by the given id, or null if
there is no cooresponding object (through receiveResult on c). |
int |
getSize()
Returns the number of Ids currently stored in the catalog |
long |
getTotalSize()
Returns the total size of the stored data in bytes.The result is returned via the receiveResult method on the provided Continuation with an Integer representing the size. |
void |
rename(Id oldId,
Id newId,
Continuation c)
Renames the given object to the new id. |
IdSet |
scan()
Return all objects currently stored by this catalog NOTE: This method blocks so if the behavior of this method changes and no longer stored in memory, this method may be deprecated. |
IdSet |
scan(IdRange range)
Return the objects identified by the given range of ids. |
java.util.SortedMap |
scanMetadata()
Returns a map which contains keys mapping ids to the associated metadata. |
java.util.SortedMap |
scanMetadata(IdRange range)
Returns a map which contains keys mapping ids to the associated metadata. |
java.util.SortedMap |
scanMetadataValuesHead(java.lang.Object value)
Returns the submapping of ids which have metadata less than the provided value. |
java.util.SortedMap |
scanMetadataValuesNull()
Returns the submapping of ids which have metadata null |
void |
setMetadata(Id id,
java.io.Serializable metadata,
Continuation command)
Updates the metadata stored under the given key to be the provided value. |
void |
store(Id id,
java.io.Serializable metadata,
java.io.Serializable obj,
Continuation c)
Stores the object under the key id . |
void |
unstore(Id id,
Continuation c)
Removes the object from the list of stored objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MemoryStorage(IdFactory factory)
factory
- The factory to build protocol-specific Ids from.Method Detail |
---|
public void flush(Continuation c)
flush
in interface Catalog
c
- The command to run once donepublic void rename(Id oldId, Id newId, Continuation c)
rename
in interface Catalog
oldId
- The id of the object in question.newId
- The new id of the object in question.c
- The command to run once the operation is completepublic void store(Id id, java.io.Serializable metadata, java.io.Serializable obj, Continuation c)
id
. If there is already
an object under id
, that object is replaced.
This method completes by calling recieveResult() of the provided continuation
with the success or failure of the operation.
store
in interface Storage
obj
- The object to be made persistent.id
- The object's id.metadata
- The object's metadatac
- The command to run once the operation is completepublic void unstore(Id id, Continuation c)
false
is returned.
This method completes by calling recieveResult() of the provided continuation
with the success or failure of the operation.
unstore
in interface Storage
id
- The object's persistence idc
- The command to run once the operation is completepublic boolean exists(Id id)
exists
in interface Catalog
id
- The id to check
public java.io.Serializable getMetadata(Id id)
getMetadata
in interface Catalog
id
- The id for which the metadata is needed
public void setMetadata(Id id, java.io.Serializable metadata, Continuation command)
setMetadata
in interface Catalog
id
- The id for the metadatametadata
- The metadata to storec
- The command to run once the operation is completepublic void getObject(Id id, Continuation c)
null
if
there is no cooresponding object (through receiveResult on c).
getObject
in interface Catalog
id
- The id of the object in question.c
- The command to run once the operation is completepublic IdSet scan(IdRange range)
scan
in interface Catalog
range
- The range to query
public IdSet scan()
scan
in interface Catalog
public java.util.SortedMap scanMetadata(IdRange range)
scanMetadata
in interface Catalog
range
- The range to query
public java.util.SortedMap scanMetadata()
scanMetadata
in interface Catalog
public java.util.SortedMap scanMetadataValuesHead(java.lang.Object value)
scanMetadataValuesHead
in interface Catalog
value
- The maximal metadata value
public java.util.SortedMap scanMetadataValuesNull()
scanMetadataValuesNull
in interface Catalog
public long getTotalSize()
getTotalSize
in interface Catalog
c
- The command to run once the operation is complete
public int getSize()
getSize
in interface Catalog
|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |