|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrice.persistence.PersistentStorage
This class is an implementation of Storage which provides persistent storage to disk. This class also guarentees that the data will be consistent, even after a crash. This class also provides these services is a non-blocking fashion by launching a seperate thread which is tasked with actaully writing the data to disk.
Constructor Summary | |
PersistentStorage(IdFactory factory,
java.lang.String rootDir,
int size)
Builds a PersistentStorage given a root directory in which to persist the data. |
|
PersistentStorage(IdFactory factory,
java.lang.String name,
java.lang.String rootDir,
int size)
Builds a PersistentStorage given and an instance name and a root directoy in which to persist the data. |
Method Summary | |
boolean |
exists(Id id)
Returns whether or not an object is present in the location id . |
void |
exists(Id id,
Continuation c)
Returns whether or not an object is present in the location id . |
void |
getObject(Id id,
Continuation c)
Returns the object identified by the given id. |
java.lang.String |
getRoot()
gets the root directory that the persistence Manager uses |
long |
getStorageSize()
gets the amount of storage that the persistence Manager uses |
void |
getTotalSize(Continuation c)
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. |
IdSet |
scan(IdRange range)
Return the objects identified by the given range of ids. |
void |
scan(IdRange range,
Continuation c)
Return the objects identified by the given range of ids. |
boolean |
setRoot(java.lang.String dir)
Sets the root directory that the persistence Manager uses |
boolean |
setStorageSize(int size)
Sets the amount of storage that the persistence Manager uses |
void |
store(Id id,
java.io.Serializable obj,
Continuation c)
Makes the object persistent to disk and stored permanantly If the object is already persistent, this method will simply update the object's serialized image. |
void |
unstore(Id id,
Continuation c)
Request to remove the object from the list of persistend objects. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PersistentStorage(IdFactory factory, java.lang.String rootDir, int size)
factory
- The factory to use for creating Ids.rootDir
- The root directory of the persisted disk.size
- the size of the storage in bytespublic PersistentStorage(IdFactory factory, java.lang.String name, java.lang.String rootDir, int size)
factory
- The factory to use for creating Ids.name
- the name of this instancerootDir
- The root directory of the persisted disk.size
- the size of the storage in bytesMethod Detail |
public void store(Id id, java.io.Serializable obj, Continuation c)
store
in interface Storage
obj
- The object to be made persistent.id
- The object's id.c
- The command to run once the operation is complete
true
if the action succeeds, else
false
.public void unstore(Id id, Continuation c)
false
is returned.
This method also guarantees that the data on disk will remain consistent,
even after a crash by performing the delete atomically.
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 complete
true
if the action succeeds, else
false
.public boolean exists(Id id)
id
.
exists
in interface Catalog
id
- The id of the object in question.
public void exists(Id id, Continuation c)
id
.
The result is returned via the receiveResult method on the provided
Continuation with an Boolean represnting the result.
exists
in interface Catalog
c
- The command to run once the operation is completeid
- The id of the object in question.
public void getObject(Id id, Continuation c)
getObject
in interface Catalog
id
- The id of the object in question.c
- The command to run once the operation is complete
null
if there is no cooresponding
object (through receiveResult on c).public void scan(IdRange range, Continuation c)
scan
in interface Catalog
range
- The range to queryc
- The command to run once the operation is complete
public IdSet scan(IdRange range)
scan
in interface Catalog
range
- The range to query
public void getTotalSize(Continuation c)
getTotalSize
in interface Catalog
c
- The command to run once the operation is complete
public boolean setRoot(java.lang.String dir)
dir
- the String representing the directory to use
public java.lang.String getRoot()
public long getStorageSize()
public boolean setStorageSize(int size)
size
- the amount of storage available to use in MB
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |