|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.p2p.replication.manager.ReplicationManagerImpl
public class ReplicationManagerImpl
Nested Class Summary | |
---|---|
protected class |
ReplicationManagerImpl.ReplicationManagerDeleter
Inner class which keeps track of the keys which we are currently deleting |
protected class |
ReplicationManagerImpl.ReplicationManagerHelper
Inner class which keeps track of the state we're in- waiting, sleeping, or with nothing to do. |
Field Summary | |
---|---|
protected ReplicationManagerClient |
client
The client of this manager |
protected ReplicationManagerImpl.ReplicationManagerDeleter |
deleter
The deleter, for managing ids to delete |
protected Endpoint |
endpoint
The endpoint used for sending reminder messages |
protected Environment |
environment
|
protected IdFactory |
factory
The id factory used for manipulating ids |
int |
FETCH_DELAY
The amount of time to wait between fetch calls to the client |
protected ReplicationManagerImpl.ReplicationManagerHelper |
helper
The helper for the replication manager |
protected java.lang.String |
instance
|
protected Logger |
logger
|
int |
NUM_DELETE_AT_ONCE
The number of ids to delete at a given time - others will be deleted later |
protected ReplicationImpl |
replication
The replication used by the manager |
int |
TIMEOUT_DELAY
The amount of time to wait before giving up on a client fetch |
Constructor Summary | |
---|---|
ReplicationManagerImpl(Node node,
ReplicationManagerClient client,
int replicationFactor,
java.lang.String instance)
Constructor |
|
ReplicationManagerImpl(Node node,
ReplicationManagerClient client,
int replicationFactor,
java.lang.String instance,
ReplicationPolicy policy)
Constructor |
Method Summary | |
---|---|
protected IdSet |
clone(IdSet keySet)
Internal method which clones an IdSet, so that iterators work as expected |
void |
deliver(Id id,
Message message)
This method is called on the application at the destination node for the given id. |
void |
fetch(IdSet keySet,
NodeHandle hint)
This upcall is invoked to notify the application that is should fetch the cooresponding keys in this set, since the node is now responsible for these keys also. |
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. |
Replication |
getReplication()
Utility method which returns the underlying replication object. |
protected void |
informClient(Id id,
NodeHandle hint)
Internal method which informs the client of the next id to fetch |
IdSet |
scan(IdRange range)
This upcall should return the set of keys that the application currently stores in this range. |
protected void |
scheduleNext()
Internal method which schedules the next reminder message (if it is necessary), or simply resets the active flag if there's nothing to be fetched. |
void |
setRange(IdRange range)
This upcall is to notify the application of the range of keys for which it is responsible. |
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, toString, wait, wait, wait |
Field Detail |
---|
public final int FETCH_DELAY
public final int TIMEOUT_DELAY
public final int NUM_DELETE_AT_ONCE
protected IdFactory factory
protected Endpoint endpoint
protected ReplicationImpl replication
protected ReplicationManagerClient client
protected ReplicationManagerImpl.ReplicationManagerHelper helper
protected ReplicationManagerImpl.ReplicationManagerDeleter deleter
protected java.lang.String instance
protected Environment environment
protected Logger logger
Constructor Detail |
---|
public ReplicationManagerImpl(Node node, ReplicationManagerClient client, int replicationFactor, java.lang.String instance)
node
- The node below this Replication implementationclient
- The client for this ReplicationreplicationFactor
- The replication factor for this instanceinstance
- The unique instance name of this Replicationpublic ReplicationManagerImpl(Node node, ReplicationManagerClient client, int replicationFactor, java.lang.String instance, ReplicationPolicy policy)
node
- The node below this Replication implementationclient
- The client for this ReplicationreplicationFactor
- The replication factor for this instanceinstance
- The unique instance name of this Replicationpolicy
- The replication policy to useMethod Detail |
---|
protected IdSet clone(IdSet keySet)
keySet
- The set to clone
protected void informClient(Id id, NodeHandle hint)
id
- The id which the client should fetchhint
- The hint where the id may beprotected void scheduleNext()
public void fetch(IdSet keySet, NodeHandle hint)
fetch
in interface ReplicationClient
keySet
- set containing the keys that needs to be fetchedhint
- A hint as to where to find the ids in the key set. This
is where the local node heard about the keys from.public void setRange(IdRange range)
setRange
in interface ReplicationClient
range
- the range of keys for which the local node is currently
responsiblepublic IdSet scan(IdRange range)
scan
in interface ReplicationClient
range
- the requested rangepublic 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 Replication getReplication()
getReplication
in interface ReplicationManager
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |