|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.p2p.past.PastImpl
public class PastImpl
Nested Class Summary | |
---|---|
static interface |
PastImpl.MessageBuilder
Class which builds a message |
protected class |
PastImpl.PastDeserializer
|
Field Summary | |
---|---|
protected Cache |
backup
|
protected PastContentDeserializer |
contentDeserializer
|
protected PastContentHandleDeserializer |
contentHandleDeserializer
|
protected Endpoint |
endpoint
|
protected Environment |
environment
|
protected IdFactory |
factory
|
int |
fetchHandles
|
int |
inserts
|
protected java.lang.String |
instance
|
protected LockManager |
lockManager
|
protected Logger |
logger
|
int |
lookups
|
int |
MESSAGE_TIMEOUT
|
int |
other
|
protected PastPolicy |
policy
|
protected ReplicationManager |
replicaManager
|
protected int |
replicationFactor
|
SocketStrategy |
socketStrategy
|
protected StorageManager |
storage
|
double |
SUCCESSFUL_INSERT_THRESHOLD
|
protected StorageManager |
trash
|
Constructor Summary | |
---|---|
PastImpl(Node node,
StorageManager manager,
Cache backup,
int replicas,
java.lang.String instance,
PastPolicy policy,
StorageManager trash)
|
|
PastImpl(Node node,
StorageManager manager,
Cache backup,
int replicas,
java.lang.String instance,
PastPolicy policy,
StorageManager trash,
boolean useOwnSocket)
|
|
PastImpl(Node node,
StorageManager manager,
Cache backup,
int replicas,
java.lang.String instance,
PastPolicy policy,
StorageManager trash,
SocketStrategy strategy)
Constructor for Past |
|
PastImpl(Node node,
StorageManager manager,
int replicas,
java.lang.String instance)
Constructor for Past, using the default policy |
|
PastImpl(Node node,
StorageManager manager,
int replicas,
java.lang.String instance,
PastPolicy policy)
Constructor for Past |
Method Summary | |
---|---|
protected ReplicationManager |
buildReplicationManager(Node node,
java.lang.String instance)
Internal method which builds the replication manager. |
void |
cache(PastContent content,
Continuation command)
Method which inserts the given object into the cache |
void |
deliver(Id id,
Message message)
This method is called on the application at the destination node for the given id. |
protected void |
doInsert(Id id,
PastImpl.MessageBuilder builder,
Continuation command,
boolean useSocket)
Internal method which actually performs an insert for a given object. |
boolean |
exists(Id id)
This upcall should return whether or not the given id is currently stored by the client. |
void |
existsInOverlay(Id id,
Continuation command)
This upcall should return whether or not the given id is currently stored somewhere in the overlay by the client. |
void |
fetch(Id id,
NodeHandle hint,
Continuation command)
This upcall is invoked to tell the client to fetch the given id, and to call the given command with the boolean result once the fetch is completed. |
void |
fetch(PastContentHandle handle,
Continuation command)
Retrieves the object associated with a given content handle. |
boolean |
forward(RouteMessage message)
This method is invoked on applications when the underlying node is about to forward the given message with the provided target to the specified next hop. |
Endpoint |
getEndpoint()
Returns the endpoint associated with the Past - ONLY FOR TESTING - DO NOT USE |
Environment |
getEnvironment()
|
protected Continuation |
getFetchResponseContinuation(PastMessage msg)
Do like above, but use a socket |
protected void |
getHandles(Id id,
int max,
Continuation command)
Internal method which returns the handles to an object. |
java.lang.String |
getInstance()
|
NodeHandle |
getLocalNodeHandle()
get the nodeHandle of the local Past node |
Continuation[] |
getOutstandingMessages()
Returns of the outstanding messages. |
Replication |
getReplication()
Returns the replica manager for this Past instance. |
int |
getReplicationFactor()
Returns the number of replicas used in this Past |
protected Continuation |
getResponseContinuation(PastMessage msg)
Returns a continuation which will respond to the given message. |
StorageManager |
getStorageManager()
Returns this Past's storage manager. |
protected int |
getUID()
Returns a new uid for a message |
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)
Method which performs the same as lookup(), but allows the callee to specify if the data should be cached. |
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 |
reInsert(Id id,
Continuation command)
Asks a client to reinsert an object it already holds into the overlay |
void |
remove(Id id,
Continuation command)
This upcall is to notify the client that the given id can be safely removed from the storage. |
IdSet |
scan()
This upcall should return the set of keys that the application currently stores. |
IdSet |
scan(IdRange range)
This upcall should return the set of keys that the application currently stores in this range. |
protected void |
sendRequest(Id id,
PastMessage message,
Continuation command)
Sends a request message across the wire, and stores the appropriate continuation. |
protected void |
sendRequest(Id id,
PastMessage message,
NodeHandle hint,
Continuation command)
Sends a request message across the wire, and stores the appropriate continuation. |
protected void |
sendRequest(NodeHandle handle,
PastMessage message,
Continuation command)
Sends a request message across the wire, and stores the appropriate continuation. |
void |
setContentDeserializer(PastContentDeserializer deserializer)
|
void |
setContentHandleDeserializer(PastContentHandleDeserializer deserializer)
|
java.lang.String |
toString()
|
void |
update(NodeHandle handle,
boolean joined)
This method is invoked to inform the application that the given node has either joined or left the neighbor set of the local node, as the set would be returned by the neighborSet call. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final int MESSAGE_TIMEOUT
public final double SUCCESSFUL_INSERT_THRESHOLD
protected Endpoint endpoint
protected StorageManager storage
protected StorageManager trash
protected Cache backup
protected int replicationFactor
protected ReplicationManager replicaManager
protected LockManager lockManager
protected PastPolicy policy
protected IdFactory factory
protected java.lang.String instance
public int inserts
public int lookups
public int fetchHandles
public int other
protected Environment environment
protected Logger logger
protected PastContentDeserializer contentDeserializer
protected PastContentHandleDeserializer contentHandleDeserializer
public SocketStrategy socketStrategy
Constructor Detail |
---|
public PastImpl(Node node, StorageManager manager, int replicas, java.lang.String instance)
node
- The node below this Past implementationmanager
- The storage manager to be used by Pastreplicas
- The number of object replicasinstance
- The unique instance name of this Pastpublic PastImpl(Node node, StorageManager manager, int replicas, java.lang.String instance, PastPolicy policy)
node
- The node below this Past implementationmanager
- The storage manager to be used by Pastreplicas
- The number of object replicasinstance
- The unique instance name of this Pastpublic PastImpl(Node node, StorageManager manager, Cache backup, int replicas, java.lang.String instance, PastPolicy policy, StorageManager trash)
public PastImpl(Node node, StorageManager manager, Cache backup, int replicas, java.lang.String instance, PastPolicy policy, StorageManager trash, boolean useOwnSocket)
node
- manager
- backup
- replicas
- instance
- policy
- trash
- useOwnSocket
- send all inserts/fetches over a socket (default is false)public PastImpl(Node node, StorageManager manager, Cache backup, int replicas, java.lang.String instance, PastPolicy policy, StorageManager trash, SocketStrategy strategy)
node
- The node below this Past implementationmanager
- The storage manager to be used by Pastreplicas
- The number of object replicasinstance
- The unique instance name of this PastMethod Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public Environment getEnvironment()
getEnvironment
in interface Past
protected ReplicationManager buildReplicationManager(Node node, java.lang.String instance)
node
- The node to base the RM off ofinstance
- The instance name to use
public Continuation[] getOutstandingMessages()
public Endpoint getEndpoint()
protected int getUID()
protected Continuation getResponseContinuation(PastMessage msg)
protected Continuation getFetchResponseContinuation(PastMessage msg)
msg
-
protected void sendRequest(Id id, PastMessage message, Continuation command)
id
- The destination idmessage
- The message to send.command
- The command to run once a result is receivedprotected void sendRequest(NodeHandle handle, PastMessage message, Continuation command)
handle
- The node handle to send directly toomessage
- The message to send.command
- The command to run once a result is receivedprotected void sendRequest(Id id, PastMessage message, NodeHandle hint, Continuation command)
id
- The destination idmessage
- The message to send.handle
- The first hop hintcommand
- The command to run once a result is receivedprotected void getHandles(Id id, int max, Continuation command)
id
- The id to fetch the handles formax
- The maximum number of handles to returncommand
- The command to call with the result (NodeHandle[])public void cache(PastContent content, Continuation command)
content
- The content to cachecommand
- The command to run once doneprotected void doInsert(Id id, PastImpl.MessageBuilder builder, Continuation command, boolean useSocket)
obj
- The object to insertbuilder
- The object which builds the messagescommand
- The command to call once donepublic void insert(PastContent obj, Continuation command)
insert
in interface Past
obj
- the object to be insertedcommand
- Command to be performed when the result is receivedpublic void lookup(Id id, Continuation command)
lookup
in interface Past
id
- the key to be queriedcommand
- Command to be performed when the result is receivedpublic void lookup(Id id, boolean cache, Continuation command)
lookup
in interface Past
id
- the key to be queriedcache
- Whether or not the data should be cachedcommand
- Command to be performed when the result is receivedpublic void lookupHandles(Id id, int max, Continuation command)
lookupHandles
in interface Past
id
- the key to be queriedmax
- the maximal number of replicas requestedcommand
- Command to be performed when the result is receivedpublic void lookupHandle(Id id, NodeHandle handle, Continuation command)
lookupHandle
in interface Past
id
- the key to be queriedhandle
- The node on which the handle is requestedcommand
- Command to be performed when the result is receivedpublic void fetch(PastContentHandle handle, Continuation command)
fetch
in interface Past
id
- the key to be queriedcommand
- Command to be performed when the result is receivedpublic NodeHandle getLocalNodeHandle()
getLocalNodeHandle
in interface Past
public int getReplicationFactor()
getReplicationFactor
in interface Past
public boolean forward(RouteMessage message)
forward
in interface Application
message
- The message being sent, containing an internal message
along with a destination key and nodeHandle next hop.
public void deliver(Id id, Message message)
deliver
in interface Application
id
- The destination id of the messagemessage
- The message being sentpublic void update(NodeHandle handle, boolean joined)
update
in interface Application
handle
- The handle that has joined/leftjoined
- Whether the node has joined or leftpublic void fetch(Id id, NodeHandle hint, Continuation command)
fetch
in interface ReplicationManagerClient
id
- The id to fetchhint
- A hint where to find the key from. This is where the local node
heard about the key.command
- The command to return the result topublic void remove(Id id, Continuation command)
remove
in interface ReplicationManagerClient
id
- The id to removepublic IdSet scan(IdRange range)
scan
in interface ReplicationManagerClient
range
- the requested rangepublic IdSet scan()
range
- the requested rangepublic boolean exists(Id id)
exists
in interface ReplicationManagerClient
id
- The id in question
public void existsInOverlay(Id id, Continuation command)
ReplicationManagerClient
existsInOverlay
in interface ReplicationManagerClient
id
- The id in questionpublic void reInsert(Id id, Continuation command)
ReplicationManagerClient
reInsert
in interface ReplicationManagerClient
id
- The id in questionpublic Replication getReplication()
public StorageManager getStorageManager()
public java.lang.String getInstance()
getInstance
in interface Past
public void setContentDeserializer(PastContentDeserializer deserializer)
setContentDeserializer
in interface Past
public void setContentHandleDeserializer(PastContentHandleDeserializer deserializer)
setContentHandleDeserializer
in interface Past
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |