| 
 | Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--rice.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(rice.p2p.commonapi.IdFactory factory,
                  java.lang.String rootDir,
                  int size)Builds a PersistentStorage given a root directory in which to persist the data. | |
| PersistentStorage(rice.p2p.commonapi.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(rice.p2p.commonapi.Id id)Returns whether or not an object is present in the location id. | 
|  void | exists(rice.p2p.commonapi.Id id,
       rice.Continuation c)Returns whether or not an object is present in the location id. | 
|  void | getObject(rice.p2p.commonapi.Id id,
          rice.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(rice.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. | 
|  rice.p2p.commonapi.IdSet | scan(rice.p2p.commonapi.IdRange range)Return the objects identified by the given range of ids. | 
|  void | scan(rice.p2p.commonapi.IdRange range,
     rice.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(rice.p2p.commonapi.Id id,
      java.io.Serializable obj,
      rice.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(rice.p2p.commonapi.Id id,
        rice.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(rice.p2p.commonapi.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 bytes
public PersistentStorage(rice.p2p.commonapi.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 bytes| Method Detail | 
public void store(rice.p2p.commonapi.Id id,
                  java.io.Serializable obj,
                  rice.Continuation c)
store in interface Storageobj - 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(rice.p2p.commonapi.Id id,
                    rice.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 Storageid - The object's persistence idc - The command to run once the operation is complete
true if the action succeeds, else
 false.public boolean exists(rice.p2p.commonapi.Id id)
id.
exists in interface Catalogid - The id of the object in question.
public void exists(rice.p2p.commonapi.Id id,
                   rice.Continuation c)
id.
 The result is returned via the receiveResult method on the provided
 Continuation with an Boolean represnting the result.
exists in interface Catalogc - The command to run once the operation is completeid - The id of the object in question.
public void getObject(rice.p2p.commonapi.Id id,
                      rice.Continuation c)
getObject in interface Catalogid - 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(rice.p2p.commonapi.IdRange range,
                 rice.Continuation c)
scan in interface Catalogrange - The range to queryc - The command to run once the operation is complete
public rice.p2p.commonapi.IdSet scan(rice.p2p.commonapi.IdRange range)
scan in interface Catalogrange - The range to query
public void getTotalSize(rice.Continuation c)
getTotalSize in interface Catalogc - 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
| 
 | Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||