ePOST API

rice.p2p.replication.manager
Class ReplicationManagerImpl.ReplicationManagerHelper

java.lang.Object
  extended by rice.p2p.replication.manager.ReplicationManagerImpl.ReplicationManagerHelper
Enclosing class:
ReplicationManagerImpl

protected class ReplicationManagerImpl.ReplicationManagerHelper
extends java.lang.Object

Inner class which keeps track of the state we're in- waiting, sleeping, or with nothing to do.


Field Summary
protected  Id current
          The next message UID which is available
protected  java.util.HashMap hints
          A cache of hints, mapping Id -> NodeHandle
protected  IdSet set
          The set of keys we have yet to fetch
protected  int state
          The current state that we are in
 int STATE_NOTHING
          The set of possible states we can be in
 int STATE_SLEEPING
           
 int STATE_WAITING
           
 
Constructor Summary
ReplicationManagerImpl.ReplicationManagerHelper()
          Constructor
 
Method Summary
 void fetch(IdSet keySet, NodeHandle hint)
          Method by which keys are added to the list of keys to fetch
protected  Id getNextId()
          Interal method which safely takes the next id to be fetched from the set of pending keys
 void message(Id id)
           
 IdSet scan(IdRange range)
          In this case, it returns the list of keys the client has, along with the keys which we have yet to tell the client to fetch.
protected  void send()
          Method which determines if a message should be sent, and if so, sends it
 void setRange(IdRange range)
          Method by which the range is set, which will delete any keys from the to fetch list not in the range
 void wakeup()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_NOTHING

public int STATE_NOTHING
The set of possible states we can be in


STATE_WAITING

public int STATE_WAITING

STATE_SLEEPING

public int STATE_SLEEPING

state

protected int state
The current state that we are in


set

protected IdSet set
The set of keys we have yet to fetch


current

protected Id current
The next message UID which is available


hints

protected java.util.HashMap hints
A cache of hints, mapping Id -> NodeHandle

Constructor Detail

ReplicationManagerImpl.ReplicationManagerHelper

public ReplicationManagerImpl.ReplicationManagerHelper()
Constructor

Method Detail

fetch

public void fetch(IdSet keySet,
                  NodeHandle hint)
Method by which keys are added to the list of keys to fetch

Parameters:
keySet - The keys to add

setRange

public void setRange(IdRange range)
Method by which the range is set, which will delete any keys from the to fetch list not in the range

Parameters:
range - The new range

scan

public IdSet scan(IdRange range)
In this case, it returns the list of keys the client has, along with the keys which we have yet to tell the client to fetch.

Parameters:
range - the requested range

send

protected void send()
Method which determines if a message should be sent, and if so, sends it


getNextId

protected Id getNextId()
Interal method which safely takes the next id to be fetched from the set of pending keys

Returns:
The next key to be fetched

wakeup

public void wakeup()

message

public void message(Id id)

ePOST API

Copyright © 2001-2005 - Rice Pastry.