|
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
Nested Class Summary | |
static interface |
PastImpl.MessageBuilder
Class which builds a message |
protected class |
PastImpl.PastDeserializer
DESCRIBE THE CLASS |
Field Summary | |
protected Cache |
backup
DESCRIBE THE FIELD |
protected PastContentDeserializer |
contentDeserializer
DESCRIBE THE FIELD |
protected PastContentHandleDeserializer |
contentHandleDeserializer
DESCRIBE THE FIELD |
protected Endpoint |
endpoint
DESCRIBE THE FIELD |
protected Environment |
environment
DESCRIBE THE FIELD |
protected IdFactory |
factory
DESCRIBE THE FIELD |
int |
fetchHandles
DESCRIBE THE FIELD |
int |
inserts
DESCRIBE THE FIELD |
protected java.lang.String |
instance
DESCRIBE THE FIELD |
protected Logger |
logger
DESCRIBE THE FIELD |
int |
lookups
DESCRIBE THE FIELD |
int |
MESSAGE_TIMEOUT
DESCRIBE THE FIELD |
int |
other
DESCRIBE THE FIELD |
protected PastPolicy |
policy
DESCRIBE THE FIELD |
protected ReplicationManager |
replicaManager
DESCRIBE THE FIELD |
protected int |
replicationFactor
DESCRIBE THE FIELD |
SocketStrategy |
socketStrategy
DESCRIBE THE FIELD |
protected StorageManager |
storage
DESCRIBE THE FIELD |
double |
SUCCESSFUL_INSERT_THRESHOLD
DESCRIBE THE FIELD |
protected StorageManager |
trash
DESCRIBE THE FIELD |
Constructor Summary | |
PastImpl(Node node,
StorageManager manager,
Cache backup,
int replicas,
java.lang.String instance,
PastPolicy policy,
StorageManager trash)
Constructor for PastImpl. |
|
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)
DESCRIBE THE METHOD |
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()
Gets the Environment attribute of the PastImpl object |
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()
Gets the Instance attribute of the PastImpl object |
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)
DESCRIBE THE METHOD |
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)
Sets the ContentDeserializer attribute of the PastImpl object |
void |
setContentHandleDeserializer(PastContentHandleDeserializer deserializer)
Sets the ContentHandleDeserializer attribute of the PastImpl object |
java.lang.String |
toString()
DESCRIBE THE METHOD |
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 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 Pastpolicy
- DESCRIBE THE PARAMETERpublic PastImpl(Node node, StorageManager manager, Cache backup, int replicas, java.lang.String instance, PastPolicy policy, StorageManager trash)
node
- DESCRIBE THE PARAMETERmanager
- DESCRIBE THE PARAMETERbackup
- DESCRIBE THE PARAMETERreplicas
- DESCRIBE THE PARAMETERinstance
- DESCRIBE THE PARAMETERpolicy
- DESCRIBE THE PARAMETERtrash
- DESCRIBE THE PARAMETERpublic 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 Pastbackup
- DESCRIBE THE PARAMETERpolicy
- DESCRIBE THE PARAMETERtrash
- DESCRIBE THE PARAMETERstrategy
- DESCRIBE THE PARAMETERMethod Detail |
public Environment getEnvironment()
getEnvironment
in interface Past
public Continuation[] getOutstandingMessages()
public Endpoint getEndpoint()
protected int getUID()
protected Continuation getResponseContinuation(PastMessage msg)
msg
- DESCRIBE THE PARAMETER
protected Continuation getFetchResponseContinuation(PastMessage msg)
msg
-
protected 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 NodeHandle getLocalNodeHandle()
getLocalNodeHandle
in interface Past
public int getReplicationFactor()
getReplicationFactor
in interface Past
public Replication getReplication()
public StorageManager getStorageManager()
public java.lang.String getInstance()
getInstance
in interface Past
public void setContentDeserializer(PastContentDeserializer deserializer)
setContentDeserializer
in interface Past
deserializer
- The new ContentDeserializer valuepublic void setContentHandleDeserializer(PastContentHandleDeserializer deserializer)
setContentHandleDeserializer
in interface Past
deserializer
- The new ContentHandleDeserializer valuepublic java.lang.String toString()
protected ReplicationManager buildReplicationManager(Node node, java.lang.String instance)
node
- The node to base the RM off ofinstance
- The instance name to use
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.command
- The command to run once a result is receivedhint
- DESCRIBE THE PARAMETERpublic 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)
builder
- The object which builds the messagescommand
- The command to call once doneid
- DESCRIBE THE PARAMETERuseSocket
- DESCRIBE THE PARAMETERpublic 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
command
- Command to be performed when the result is receivedhandle
- DESCRIBE THE PARAMETERpublic 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
- DESCRIBE THE PARAMETERcommand
- DESCRIBE THE PARAMETERpublic void remove(Id id, Continuation command)
remove
in interface ReplicationManagerClient
id
- The id to removecommand
- DESCRIBE THE PARAMETERpublic IdSet scan(IdRange range)
scan
in interface ReplicationManagerClient
range
- the requested range
public IdSet scan()
public boolean exists(Id id)
exists
in interface ReplicationManagerClient
id
- The id in question
public void existsInOverlay(Id id, Continuation command)
existsInOverlay
in interface ReplicationManagerClient
id
- DESCRIBE THE PARAMETERcommand
- DESCRIBE THE PARAMETERpublic void reInsert(Id id, Continuation command)
reInsert
in interface ReplicationManagerClient
id
- DESCRIBE THE PARAMETERcommand
- DESCRIBE THE PARAMETER
|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |