public class Disseminator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
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 Cache<Id,Fetch> |
outstandingFetches
Outstanding fetch messages awaiting replies.
|
protected java.util.Random |
rand
Random source for random ids.
|
protected long |
REPLICATION_INTERVAL
Replication interval, in milliseconds.
|
Constructor and Description |
---|
Disseminator(PastryNode node,
Cache cache)
Creates a disseminator attached to the given pastry node.
|
Modifier and Type | Method and Description |
---|---|
void |
aggregateInterval()
Called once every aggregation interval.
|
void |
deliver(Id id,
Message msg) |
void |
fetch(Fetch.Reply msg)
Process a Fetch.Reply message.
|
void |
fetch(Fetch msg)
Process the Fetch message.
|
ObjectGlob |
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.
|
void |
replicate(Replicate.Reply msg)
Processes a Replicate.Reply message, and adds objects in the reply to the
cache.
|
void |
replicate(Replicate msg)
Processes a Replicate message.
|
void |
replicateInterval()
Called once every replicate interval.
|
protected void |
reply(Cache.Entry entry,
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) |
void |
updateCache(AbstractUpdate.Reply msg)
Processes the given UpdateCache.Reply message.
|
<UpdateType extends FastSerializable> |
updateCache(AbstractUpdate<UpdateType> msg)
Processes the given UpdateCache message.
|
protected final PastryNode node
protected final Endpoint endpoint
protected final IdFactory idf
protected final int idDigits
protected final int baseBits
protected final java.util.Random rand
protected final Cache cache
protected final Cache<Id,Fetch> outstandingFetches
protected final MessageDeserializer deserializer
protected long REPLICATION_INTERVAL
protected long AGGREGATION_INTERVAL
public Disseminator(PastryNode node, Cache cache)
node
- PastryNode where the disseminator is to run.protected void route(Id id, Message message, NodeHandle hint)
id
- The id of this message (hash value where it should be routed)message
- The message to be routedhint
- NodeHandle of a starting node, if desiredprotected NodeHandle localHandle()
public void deliver(Id id, Message msg)
public ObjectGlob fetch(RemoteStore c, long onum) throws DisseminationTimeoutException
DisseminationTimeoutException
- if the dissemination network takes too long.public void fetch(Fetch.Reply msg)
public void fetch(Fetch msg)
protected void reply(Cache.Entry entry, Fetch msg)
public <UpdateType extends FastSerializable> void updateCache(AbstractUpdate<UpdateType> msg)
public void updateCache(AbstractUpdate.Reply msg)
public void replicateInterval()
public void replicate(Replicate msg)
public void replicate(Replicate.Reply msg)
public void aggregateInterval()
public boolean forward(RouteMessage message)
public void update(NodeHandle handle, boolean joined)