Rice Pastry API

rice.p2p.past
Interface Past

All Known Implementing Classes:
PastImpl

public interface Past

Version:
$Id: Past.java,v 1.6 2003/07/28 06:07:13 amislove Exp $
Author:
Alan Mislove, Ansley Post, Peter Druschel

Method Summary
 void fetch(rice.p2p.past.PastContentHandle handle, rice.Continuation command)
          Retrieves the object associated with a given content handle.
 rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
          get the nodeHandle of the local Past node
 int getReplicationFactor()
          Returns the number of replicas used in this Past
 void insert(rice.p2p.past.PastContent obj, rice.Continuation command)
          Inserts an object with the given ID into this instance of Past.
 void lookup(rice.p2p.commonapi.Id id, rice.Continuation command)
          Retrieves the object stored in this instance of Past with the given ID.
 void lookupHandles(rice.p2p.commonapi.Id id, int max, rice.Continuation command)
          Retrieves the handles of up to max replicas of the object stored in this instance of Past with the given ID.
 rice.p2p.commonapi.IdSet scan(rice.p2p.commonapi.IdRange range)
          Return the ids of objects stored in this instance of Past on the *local* node, with ids in a given range.
 

Method Detail

insert

public void insert(rice.p2p.past.PastContent obj,
                   rice.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

public void lookup(rice.p2p.commonapi.Id id,
                   rice.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.

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

lookupHandles

public void lookupHandles(rice.p2p.commonapi.Id id,
                          int max,
                          rice.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

fetch

public void fetch(rice.p2p.past.PastContentHandle handle,
                  rice.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

scan

public rice.p2p.commonapi.IdSet scan(rice.p2p.commonapi.IdRange range)
Return the ids of objects stored in this instance of Past on the *local* node, with ids in a given range. The IdSet returned contains the Ids of the stored objects.

Parameters:
range - The range to query
Returns:
The set of ids

getLocalNodeHandle

public rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
get the nodeHandle of the local Past node

Returns:
the nodehandle

getReplicationFactor

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

Returns:
the number of replicas for each object

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection