rice.p2p.replication
Class ReplicationImpl

java.lang.Object
  extended byrice.p2p.replication.ReplicationImpl
All Implemented Interfaces:
Application, Replication

public class ReplicationImpl
extends java.lang.Object
implements Replication, Application


Field Summary
protected  ReplicationClient client
          This replication's client
protected  Endpoint endpoint
          this application's endpoint
protected  IdFactory factory
          The factory for create IdSets and IdRanges
protected  NodeHandle handle
          the local node handle
protected  java.util.logging.Logger log
          the logger which we will use
static int MAINTENANCE_INTERVAL
          The amount of time to wait between replications
protected  int replicationFactor
          The replication factor for this replication
 
Constructor Summary
ReplicationImpl(Node node, ReplicationClient client, int replicationFactor, java.lang.String instance)
          Constructor
 
Method Summary
 void deliver(Id id, Message message)
          This method is called on the application at the destination node for the given id.
 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.
protected  IdRange getTotalRange()
          Returns the range for which the local node is an i root, where i can range between 0 and replicationFactor
 void sendRequests()
          This internal method sends out the request messages to all of the nodes which hold keys this node may be interested in
 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

MAINTENANCE_INTERVAL

public static int MAINTENANCE_INTERVAL
The amount of time to wait between replications


endpoint

protected Endpoint endpoint
this application's endpoint


log

protected java.util.logging.Logger log
the logger which we will use


handle

protected NodeHandle handle
the local node handle


factory

protected IdFactory factory
The factory for create IdSets and IdRanges


client

protected ReplicationClient client
This replication's client


replicationFactor

protected int replicationFactor
The replication factor for this replication

Constructor Detail

ReplicationImpl

public ReplicationImpl(Node node,
                       ReplicationClient client,
                       int replicationFactor,
                       java.lang.String instance)
Constructor

Parameters:
node - The node below this Replication implementation
client - The client for this Replication
replicationFactor - The replication factor for this instance
instance - The unique instance name of this Replication
Method Detail

getTotalRange

protected IdRange getTotalRange()
Returns the range for which the local node is an i root, where i can range between 0 and replicationFactor

Returns:
The *total* range

sendRequests

public void sendRequests()
This internal method sends out the request messages to all of the nodes which hold keys this node may be interested in


forward

public 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. Applications can change the contents of the message, specify a different nextHop (through re-routing), or completely terminate the message.

Specified by:
forward in interface Application
Parameters:
message - The message being sent, containing an internal message along with a destination key and nodeHandle next hop.
Returns:
Whether or not to forward the message further

deliver

public void deliver(Id id,
                    Message message)
This method is called on the application at the destination node for the given id.

Specified by:
deliver in interface Application
Parameters:
id - The destination id of the message
message - The message being sent

update

public 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.

Specified by:
update in interface Application
Parameters:
handle - The handle that has joined/left
joined - Whether the node has joined or left





Imprint-Dataprotection