ostore.dtree
Class DTreeNode

java.lang.Object
  |
  +--ostore.dtree.DTreeNode
All Implemented Interfaces:
EventHandlerIF, SingleThreadedEventHandlerIF

public class DTreeNode
extends Object
implements SingleThreadedEventHandlerIF, EventHandlerIF

The stage responsible for fulfilling the server's roles in various dissemination trees.

Stages (e.g. the inner ring) send updates, invalidations, and other responses to secondary replicas and clients via a multicast dissemination tree. This stage implements the protocols required for the server to participate in these trees as a parent, child, or both.

USAGE

To send a message down the dissemination tree, dispatch a DownDTreeMsg containing the message and the GUID for the tree. That GUID will usually (always?) be the A-GUID for the data object which the message concerns.

The local DTreeNode stage will receive the DownDTreeMsg, extract the content message, and forward it down the tree inside a DTreeMsg using DD.

Conversely, to send a message up the dissemination tree, dispatch a UpDTreeMsg containing the message and the GUID for the tree.

To join a dissemination tree, dispatch a JoinTreeReq containing the GUID for the tree. The DTreeNode will attempt to locate a current member of the tree (including the inner ring), using a DTreeLocateMsg requesting that member to tie the local node into its tree. The remote node will return a JoinTreeResp with the result (success or failure), which this DTreeNode will dispatch locally.

If the local server wishes to publish itself as an available secondary replica for a data object, it should set the JoinTreeReq.publish flag on its request to true. The DTreeNode stage will then publish the appropriate tag in DD.

Version:
$Id: DTreeNode.java,v 1.72 2004/05/13 20:13:52 hweather Exp $
Author:
Dennis Geels
See Also:
DownDTreeMsg, UpDTreeMsg, JoinTreeReq, JoinTreeResp, DTreeMsg, DTreeLocateMsg

Field Summary
protected static Double DEFAULT_DISTANCE_GUESS
          The latency estimate to use for peers that don't appear in the RoutingTable.
protected  Map engines
          A QSSignature->Signature map for storing verification engines for the various signature algorithms used.
protected static long MSG_TIMEOUT
          The number of milliseconds to wait before resending messages.
protected  String name
          The name by which to refer to this stage.
protected  Map node_states
          A GUID->NodeState map storing the information for tree.
protected static int NORMAL_LEASE
          The length of a link lease, in bytes.
protected  Map pending_joins
          A SecureHash->DTreeServiceReq map storing join requests, indexed by their digests.
protected static double REJOIN_DISTANCE_FACTOR
          The factor by which a single tree rejoin action can increase this node's total latency from the tree root.
protected static int RETRIES
          The number of times to retry any message.
protected static boolean USE_DISTANCE_METRIC
          A flag that determines whether to rejoin trees using the depth metric (tree hops) or distance metric (latency in ms).
 
Constructor Summary
DTreeNode()
          Initializes internal data structures.
 
Method Summary
 void destroy()
           
 void handleEvent(QueueElementIF elem)
           
 void handleEvents(QueueElementIF[] elemarr)
           
 void init(ConfigDataIF config)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_TIMEOUT

protected static final long MSG_TIMEOUT
The number of milliseconds to wait before resending messages. For now, use the same timeout for all message types. Currently 1000 (1 second).

See Also:
Constant Field Values

RETRIES

protected static final int RETRIES
The number of times to retry any message.

See Also:
Constant Field Values

NORMAL_LEASE

protected static final int NORMAL_LEASE
The length of a link lease, in bytes. Default: 1GB (almost infinite). TODO: should be much more flexible.

See Also:
Constant Field Values

DEFAULT_DISTANCE_GUESS

protected static final Double DEFAULT_DISTANCE_GUESS
The latency estimate to use for peers that don't appear in the RoutingTable.


USE_DISTANCE_METRIC

protected static final boolean USE_DISTANCE_METRIC
A flag that determines whether to rejoin trees using the depth metric (tree hops) or distance metric (latency in ms).

See Also:
Constant Field Values

REJOIN_DISTANCE_FACTOR

protected static final double REJOIN_DISTANCE_FACTOR
The factor by which a single tree rejoin action can increase this node's total latency from the tree root. Larger factors may produce slower trees, but they should be more efficient.

See Also:
Constant Field Values

name

protected String name
The name by which to refer to this stage. It should be the name of the corresponding StageIF.


node_states

protected Map node_states
A GUID->NodeState map storing the information for tree.


engines

protected Map engines
A QSSignature->Signature map for storing verification engines for the various signature algorithms used.


pending_joins

protected Map pending_joins
A SecureHash->DTreeServiceReq map storing join requests, indexed by their digests.

Constructor Detail

DTreeNode

public DTreeNode()
Initializes internal data structures.

Method Detail

handleEvent

public void handleEvent(QueueElementIF elem)
                 throws UnknownEventException
Specified by:
handleEvent in interface EventHandlerIF
UnknownEventException

handleEvents

public void handleEvents(QueueElementIF[] elemarr)
                  throws UnknownEventException
Specified by:
handleEvents in interface EventHandlerIF
UnknownEventException

init

public void init(ConfigDataIF config)
          throws Exception
Specified by:
init in interface EventHandlerIF
Exception

destroy

public void destroy()
Specified by:
destroy in interface EventHandlerIF