Rice Pastry API

rice.p2p.past
Interface Past

All Known Subinterfaces:
GCPast
All Known Implementing Classes:
AggregationImpl, GCPastImpl, GlacierImpl, Moraine, PastImpl

public interface Past

Version:
$Id: Past.java 3524 2007-01-09 14:09:27Z jeffh $
Author:
Alan Mislove, Ansley Post, Peter Druschel

Method Summary
 void fetch(PastContentHandle handle, Continuation command)
          Retrieves the object associated with a given content handle.
 Environment getEnvironment()
           
 java.lang.String getInstance()
           
 NodeHandle getLocalNodeHandle()
          get the nodeHandle of the local Past node
 int getReplicationFactor()
          Returns the number of replicas used in this Past
 void insert(PastContent obj, Continuation command)
          Inserts an object with the given ID into this instance of Past.
 void lookup(Id id, boolean cache, Continuation command)
          Retrieves the object stored in this instance of Past with the given ID.
 void lookup(Id id, Continuation command)
          Retrieves the object stored in this instance of Past with the given ID.
 void lookupHandle(Id id, NodeHandle handle, Continuation command)
          Retrieves the handle for the given object stored on the requested node.
 void lookupHandles(Id id, int max, Continuation command)
          Retrieves the handles of up to max replicas of the object stored in this instance of Past with the given ID.
 void setContentDeserializer(PastContentDeserializer deserializer)
           
 void setContentHandleDeserializer(PastContentHandleDeserializer deserializer)
           
 

Method Detail

insert

void insert(PastContent obj,
            Continuation command)
Inserts an object with the given ID into this instance of Past. Asynchronously returns a PastException to command, if the operation was unsuccessful. If the operation was successful, a Boolean[] is returned representing the responses from each of the replicas which inserted the object.

Parameters:
obj - the object to be inserted
command - Command to be performed when the result is received

lookup

void lookup(Id id,
            Continuation command)
Retrieves the object stored in this instance of Past with the given ID. Asynchronously returns a PastContent object as the result to the provided Continuation, or a PastException. This method is provided for convenience; its effect is identical to a lookupHandles() and a subsequent fetch() to the handle that is nearest in the network. The client must authenticate the object. In case of failure, an alternate replica of the object can be obtained via lookupHandles() and fetch(). This method is not safe if the object is immutable and storage nodes are not trusted. In this case, clients should used the lookUpHandles method to obtains the handles of all primary replicas and determine which replica is fresh in an application-specific manner. By default, this method attempts to cache the result locally for future use. Applications which do not desire this behavior should use the lookup(id, boolean, command) method.

Parameters:
id - the key to be queried
command - Command to be performed when the result is received

lookup

void lookup(Id id,
            boolean cache,
            Continuation command)
Retrieves the object stored in this instance of Past with the given ID. Asynchronously returns a PastContent object as the result to the provided Continuation, or a PastException. This method is provided for convenience; its effect is identical to a lookupHandles() and a subsequent fetch() to the handle that is nearest in the network. The client must authenticate the object. In case of failure, an alternate replica of the object can be obtained via lookupHandles() and fetch(). This method is not safe if the object is immutable and storage nodes are not trusted. In this case, clients should used the lookUpHandles method to obtains the handles of all primary replicas and determine which replica is fresh in an application-specific manner. This method also allows applications to specify if the result should be cached locally.

Parameters:
id - the key to be queried
cache - Whether or not the result should be cached
command - Command to be performed when the result is received

lookupHandles

void lookupHandles(Id id,
                   int max,
                   Continuation command)
Retrieves the handles of up to max replicas of the object stored in this instance of Past with the given ID. Asynchronously returns an array of PastContentHandles as the result to the provided Continuation, or a PastException. Each replica handle is obtained from a different primary storage root for the the given key. If max exceeds the replication factor r of this Past instance, only r replicas are returned. This method will return a PastContentHandle[] array containing all of the handles.

Parameters:
id - the key to be queried
max - the maximal number of replicas requested
command - Command to be performed when the result is received

lookupHandle

void lookupHandle(Id id,
                  NodeHandle handle,
                  Continuation command)
Retrieves the handle for the given object stored on the requested node. Asynchronously returns a PostContentHandle (or null) to the provided continuation.

Parameters:
id - the key to be queried
handle - The node on which the handle is requested
command - Command to be performed when the result is received

fetch

void fetch(PastContentHandle handle,
           Continuation command)
Retrieves the object associated with a given content handle. Asynchronously returns a PastContent object as the result to the provided Continuation, or a PastException. The client must authenticate the object. In case of failure, an alternate replica can be obtained using a different handle obtained via lookupHandles().

Parameters:
handle - the key to be queried
command - Command to be performed when the result is received

getLocalNodeHandle

NodeHandle getLocalNodeHandle()
get the nodeHandle of the local Past node

Returns:
the nodehandle

getReplicationFactor

int getReplicationFactor()
Returns the number of replicas used in this Past

Returns:
the number of replicas for each object

getEnvironment

Environment getEnvironment()

getInstance

java.lang.String getInstance()
Returns:

setContentDeserializer

void setContentDeserializer(PastContentDeserializer deserializer)

setContentHandleDeserializer

void setContentHandleDeserializer(PastContentHandleDeserializer deserializer)

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection