| 
 | Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--rice.persistence.StorageManager
This class provides both persistent and caching services to external applications. Building the StorageManager requires a Storage object, to provide the back-end storage, and a Cache to serve as a cache. Note that this implementation has seperate areas for the Cache and Storage, but the next version will allow the cache to use the unused storage space.
| Constructor Summary | |
| StorageManager(rice.p2p.commonapi.IdFactory factory,
               rice.persistence.Storage storage,
               rice.persistence.Cache cache)Builds a StorageManager given a Storage object to provide storage services and a Cache object to provide caching services. | |
| Method Summary | |
|  void | cache(rice.p2p.commonapi.Id id,
      java.io.Serializable obj,
      rice.Continuation c)Caches an object in this storage. | 
|  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. | 
|  rice.persistence.Cache | getCache()Returns the cache object used by this StorageManager | 
|  void | getMaximumSize(rice.Continuation c)Returns the maximum size of the cache, in bytes. | 
|  void | getObject(rice.p2p.commonapi.Id id,
          rice.Continuation c)Returns the object identified by the given id, or nullif
 there is no cooresponding object (through receiveResult on c). | 
|  rice.persistence.Storage | getStorage()Returns the permantent storage object used by this StorageManager | 
|  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. | 
|  void | setMaximumSize(int size,
               rice.Continuation c)Sets the maximum size of the cache, in bytes. | 
|  void | store(rice.p2p.commonapi.Id id,
      java.io.Serializable obj,
      rice.Continuation c)Stores an object in this storage. | 
|  void | uncache(rice.p2p.commonapi.Id id,
        rice.Continuation c)Removes the object from the list of cached objects. | 
|  void | unstore(rice.p2p.commonapi.Id id,
        rice.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 StorageManager(rice.p2p.commonapi.IdFactory factory,
                      rice.persistence.Storage storage,
                      rice.persistence.Cache cache)
factory - The factory to use for Id creationstorage - The Storage object which will serve as the
        persistent storage.cache - The Cache object which will serve as the cache.| Method Detail | 
public rice.persistence.Storage getStorage()
public rice.persistence.Cache getCache()
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.
 Returns True or False depending on whether the object
 exists (through receiveResult on c);
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)
null if
 there is no cooresponding object (through receiveResult on c).
getObject in interface Catalogid - The id of the object in question.c - The command to run once the operation is complete
public void scan(rice.p2p.commonapi.IdRange range,
                 rice.Continuation c)
scan in interface Catalogc - The command to run once the operation is completepublic 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 void store(rice.p2p.commonapi.Id id,
                  java.io.Serializable obj,
                  rice.Continuation c)
unstore(id) followed
 by store(id, obj). This method finishes by calling
 receiveResult() on the provided continuation with the success
 or failure of the store.
 Returns True if the action succeeds, else
 False (through receiveResult on c).
store in interface Storageid - The object's id.obj - The object to store.c - The command to run once the operation is complete
public void unstore(rice.p2p.commonapi.Id id,
                    rice.Continuation c)
False is returned.
 Returns True if the action succeeds, else
 False  (through receiveResult on c).
unstore in interface Storagec - The command to run once the operation is complete
public void cache(rice.p2p.commonapi.Id id,
                  java.io.Serializable obj,
                  rice.Continuation c)
uncachr(id) followed
 by cache(id, obj). This method finishes by calling
 receiveResult() on the provided continuation with whether or not
 the object was cached.  Note that the object may not actually be
 cached due to the cache replacement policy.
 Returns True if the cache actaully stores the object, else
 False (through receiveResult on c).
cache in interface Cacheid - The object's id.obj - The object to cache.c - The command to run once the operation is complete
public void uncache(rice.p2p.commonapi.Id id,
                    rice.Continuation c)
False is returned.
 Returns True if the action succeeds, else
 False  (through receiveResult on c).
uncache in interface Cachec - The command to run once the operation is completepublic void getMaximumSize(rice.Continuation c)
getMaximumSize in interface Cachec - The command to run once the operation is complete
public void setMaximumSize(int size,
                           rice.Continuation c)
setMaximumSize in interface Cachesize - The new maximum size, in bytes, of the cache.c - The command to run once the operation is complete| 
 | Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||