fabric.dissemination.pastry
Class Disseminator

java.lang.Object
  extended by fabric.dissemination.pastry.Disseminator

public class Disseminator
extends java.lang.Object

A pastry application that implements the functionality of a Fabric dissemination network based on the beehive replication protocol.


Field Summary
protected  long AGGREGATION_INTERVAL
          Aggregation interval, in milliseconds.
protected  int baseBits
           
protected  Cache cache
          The cache of fetched objects.
protected  MessageDeserializer deserializer
           
protected  Endpoint endpoint
          The pastry endpoint.
protected  int idDigits
           
protected  IdFactory idf
          The pastry id generating factory.
protected  PastryNode node
          The pastry node.
protected  java.util.Map<Id,Fetch> outstanding
          Outstanding fetch messages awaiting replies.
protected  java.util.Random rand
          Random source for random ids.
protected  long REPLICATION_INTERVAL
          Replication interval, in milliseconds.
 
Constructor Summary
Disseminator(PastryNode node)
          Creates a disseminator attached to the given pastry node.
 
Method Summary
protected  void aggregateInterval()
          Called once every aggregation interval.
 void deliver(Id id, Message msg)
           
protected  void fetch(Fetch.Reply msg)
          Process a Fetch.Reply message.
protected  void fetch(Fetch msg)
          Process the Fetch message.
 Glob fetch(RemoteStore c, long onum)
          Called by a FetchManager to fetch the specified object.
 boolean forward(RouteMessage message)
           
protected  NodeHandle localHandle()
          The NodeHandle of this pastry node.
protected  void replicate(Replicate.Reply msg)
          Processes a Replicate.Reply message, and adds objects in the reply to the cache.
protected  void replicate(Replicate msg)
          Processes a Replicate message.
protected  void replicateInterval()
          Called once every replicate interval.
protected  void reply(Glob g, Fetch msg)
          Helper function.
protected  void route(Id id, Message message, NodeHandle hint)
          Routes a message on the pastry ring.
 void update(NodeHandle handle, boolean joined)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

node

protected PastryNode node
The pastry node.


endpoint

protected Endpoint endpoint
The pastry endpoint.


idf

protected IdFactory idf
The pastry id generating factory.


idDigits

protected int idDigits

baseBits

protected int baseBits

rand

protected java.util.Random rand
Random source for random ids.


cache

protected Cache cache
The cache of fetched objects.


outstanding

protected java.util.Map<Id,Fetch> outstanding
Outstanding fetch messages awaiting replies.


deserializer

protected MessageDeserializer deserializer

REPLICATION_INTERVAL

protected long REPLICATION_INTERVAL
Replication interval, in milliseconds.


AGGREGATION_INTERVAL

protected long AGGREGATION_INTERVAL
Aggregation interval, in milliseconds.

Constructor Detail

Disseminator

public Disseminator(PastryNode node)
Creates a disseminator attached to the given pastry node.

Parameters:
node - PastryNode where the disseminator is to run.
Method Detail

route

protected void route(Id id,
                     Message message,
                     NodeHandle hint)
Routes a message on the pastry ring. At least one of id or hint must be non-null.

Parameters:
id - The id of this message (hash value where it should be routed)
message - The message to be routed
hint - NodeHandle of a starting node, if desired

localHandle

protected NodeHandle localHandle()
The NodeHandle of this pastry node.


deliver

public void deliver(Id id,
                    Message msg)

fetch

public Glob fetch(RemoteStore c,
                  long onum)
           throws DisseminationTimeoutException
Called by a FetchManager to fetch the specified object.

Throws:
DisseminationTimeoutException - if the dissemination network takes too long.

fetch

protected void fetch(Fetch.Reply msg)
Process a Fetch.Reply message. Saves the glob from the reply, and returns it to the worker if it is waiting for this object.


fetch

protected void fetch(Fetch msg)
Process the Fetch message. See if we have the object asked for. If so, return it to sender via a Fetch.Reply message.


reply

protected void reply(Glob g,
                     Fetch msg)
Helper function. Reply to a Fetch message with given glob.


replicateInterval

protected void replicateInterval()
Called once every replicate interval. This is the method responsible for contacting replication deciders for this node. The deciders then reply with the globs that they want to replicate to this node. This implements the pull protocol of beehive, since deciders don't know who they should replicate to, and depend on those node to contact them. When sending a replicate message, a list of globs that this node already has is sent to the decider, so that they are not sent again.


replicate

protected void replicate(Replicate msg)
Processes a Replicate message. Sends back to the sender objects that should be replicated to that node.


replicate

protected void replicate(Replicate.Reply msg)
Processes a Replicate.Reply message, and adds objects in the reply to the cache.


aggregateInterval

protected void aggregateInterval()
Called once every aggregation interval.


forward

public boolean forward(RouteMessage message)

update

public void update(NodeHandle handle,
                   boolean joined)