ostore.dtree
Class DTreeServiceReq

java.lang.Object
  |
  +--ostore.dtree.DTreeReq
        |
        +--ostore.dtree.DTreeServiceReq
All Implemented Interfaces:
QueueElementIF, QuickSerializable

public class DTreeServiceReq
extends DTreeReq

Messages sent from a child node to a parent node, or vice versa, asking the receiver to initiate, modify, or terminate dissemination service.

Version:
$Id: DTreeServiceReq.java,v 1.13 2003/01/02 22:39:43 geels Exp $
Author:
Dennis Geels

Field Summary
protected  long bid
          The sender's priority/bid for this request.
protected  long lease
          The number of bytes that the parent must send under the new service agreement.
protected  Double max_distance
          The maximum acceptable distance (latency, in ms) from the sender to the root of the tree.
static long PARENTAL_ORDER
          The only value of bid if the sender is the parent node.
protected  int requested_state
          The connection state that the sender wants.
protected  SecureHash sender
          The sender's GUID.
static int STATE_DESTROYED
          Denotes the destruction of the tree.
static int STATE_DISCONNECTED
          Denotes the state in which nothing is forwarded to the child - the parent is free to forget the child.
static int STATE_FULLY_CONNECTED
          Denotes the state in which all messages are forwarded to the child.
static int STATE_INVALIDATIONS_ONLY
          Denotes the state in which only heartbeats are forwarded to the child.
 
Fields inherited from class ostore.dtree.DTreeReq
digest, tree_id
 
Constructor Summary
DTreeServiceReq(InputBuffer buffer)
          Constructs a DTreeServiceReq from its serialized form.
DTreeServiceReq(SecureHash tree_id, SecureHash sender, int requested_state, long bid, long lease, Double max_distance)
          Creates a new request for the specified tree.
 
Method Summary
 long get_bid()
          Returns the sender's priority/bid for this request.
 long get_lease()
          Returns the number of bytes that the parent must send under this service agreement.
 Double get_max_distance()
          Returns the maximum acceptable distance from the sender to the root of tree.
 int get_requested_state()
          Returns the connection state that the sender wants.
 SecureHash get_sender()
          Returns the sender's GUID.
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 String toString()
          Returns a human-readable representation of this DTreeServiceReq.
 
Methods inherited from class ostore.dtree.DTreeReq
get_digest, get_seq_num, get_tree_id, hashCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_FULLY_CONNECTED

public static final int STATE_FULLY_CONNECTED
Denotes the state in which all messages are forwarded to the child.

See Also:
Constant Field Values

STATE_INVALIDATIONS_ONLY

public static final int STATE_INVALIDATIONS_ONLY
Denotes the state in which only heartbeats are forwarded to the child.

See Also:
Constant Field Values

STATE_DISCONNECTED

public static final int STATE_DISCONNECTED
Denotes the state in which nothing is forwarded to the child - the parent is free to forget the child.

See Also:
Constant Field Values

STATE_DESTROYED

public static final int STATE_DESTROYED
Denotes the destruction of the tree.

See Also:
Constant Field Values

PARENTAL_ORDER

public static final long PARENTAL_ORDER
The only value of bid if the sender is the parent node.

See Also:
Constant Field Values

sender

protected SecureHash sender
The sender's GUID.


requested_state

protected int requested_state
The connection state that the sender wants.


bid

protected long bid
The sender's priority/bid for this request. If the sender is the parent node this field should be PARENTAL_ORDER.


lease

protected long lease
The number of bytes that the parent must send under the new service agreement. After the lease expires, each endpoint may assume that the connection has become STATE_DISCONNECTED.


max_distance

protected Double max_distance
The maximum acceptable distance (latency, in ms) from the sender to the root of the tree. Valid only for join requests, and optional even then. Otherwise, null.

The join request should be rejected if the distance from the sender to the receiver plus the distance from the receiver to the root is greater than this threshold.

Constructor Detail

DTreeServiceReq

public DTreeServiceReq(SecureHash tree_id,
                       SecureHash sender,
                       int requested_state,
                       long bid,
                       long lease,
                       Double max_distance)
Creates a new request for the specified tree.

Parameters:
tree_id - the A-GUID for the tree's data object.
sender - the sender's GUID.
requested_state - The connection state that the sender wants
bid - The sender's priority/bid for this request.
lease - The number of bytes that the parent must send.
max_distance - The maximum acceptable distance to the root.

DTreeServiceReq

public DTreeServiceReq(InputBuffer buffer)
                throws QSException
Constructs a DTreeServiceReq from its serialized form.

Method Detail

get_sender

public SecureHash get_sender()
Returns the sender's GUID.


get_requested_state

public int get_requested_state()
Returns the connection state that the sender wants.


get_bid

public long get_bid()
Returns the sender's priority/bid for this request. If the sender is the parent node this field should be PARENTAL_ORDER.


get_lease

public long get_lease()
Returns the number of bytes that the parent must send under this service agreement.


get_max_distance

public Double get_max_distance()
Returns the maximum acceptable distance from the sender to the root of tree.


serialize

public void serialize(OutputBuffer buffer)
Description copied from interface: QuickSerializable
Add the object to the buffer.

Specified by:
serialize in interface QuickSerializable
Overrides:
serialize in class DTreeReq
Parameters:
buffer - the output buffer to add the object to

toString

public String toString()
Returns a human-readable representation of this DTreeServiceReq.

Overrides:
toString in class DTreeReq