ostore.read
Class ReadReq

java.lang.Object
  |
  +--ostore.read.ReadReq
All Implemented Interfaces:
QueueElementIF, QuickSerializable
Direct Known Subclasses:
BytesReadReq, HandleStoreReadReq, SliceReadReq

public abstract class ReadReq
extends Object
implements QueueElementIF, QuickSerializable

A superclass for events sent from the ReplicaStage to the ReadStage requesting the latter to read a portion of a DataObject. TODO: reuse same event for ClientStage->ReplicaStage requests?

Version:
$Id: ReadReq.java,v 1.23 2002/07/29 18:48:53 geels Exp $
Author:
Dennis Geels

Field Summary
protected  SecureHash digest
          The digest of this ReadReq.
static byte FAIL
          A value for fault_mode instructing the ReadStage to give up completely.
protected  byte fault_mode
          Specifies what the ReadStage should do if any required blocks from the DataObject are missing from the memory cache.
static byte FETCH_ALL
          A value for fault_mode instructing the ReadStage to fetch missing blocks through the block manager (memory cache).
static byte PARTIAL
          A value for fault_mode instructing the ReadStage to read as much as possible and include in its response a Selection describing the portion of the DataObject which it could not find locally.
protected  Selection sel
          The portion of the DataObject to read.
protected  VID target
          The id of the DataObject to read.
protected  SecureHash tree_id
          The GUID of the dissemination tree corresponding to this DataObject, or null if unknown.
 
Constructor Summary
protected ReadReq(InputBuffer buffer)
          Constructs a ReadReq from its serialized form.
protected ReadReq(VID target, SecureHash tree_id, Selection sel, byte fault_mode)
          Constructs a new ReadReq.
 
Method Summary
 SecureHash get_digest()
          Returns the digest of this ReadReq.
 byte get_fault_mode()
          Returns the code for the fault mode.
 Selection get_selection()
          Returns the Selection describing the read.
 QSLong get_seq_num()
          Returns the sequence number of the request.
 VID get_target()
          Returns the id of the DataObject to read.
 SecureHash get_tree_id()
          Returns the GUID of the dissemination tree for the DataObject to read.
 int hashCode()
          Returns the hash of the digest of this ReadReq.
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 String toString()
          Returns a human-readable representation of this ReaqReq.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FAIL

public static final byte FAIL
A value for fault_mode instructing the ReadStage to give up completely.

See Also:
Constant Field Values

FETCH_ALL

public static final byte FETCH_ALL
A value for fault_mode instructing the ReadStage to fetch missing blocks through the block manager (memory cache).

See Also:
Constant Field Values

PARTIAL

public static final byte PARTIAL
A value for fault_mode instructing the ReadStage to read as much as possible and include in its response a Selection describing the portion of the DataObject which it could not find locally.

See Also:
Constant Field Values

target

protected VID target
The id of the DataObject to read.


tree_id

protected SecureHash tree_id
The GUID of the dissemination tree corresponding to this DataObject, or null if unknown.


sel

protected Selection sel
The portion of the DataObject to read.


fault_mode

protected byte fault_mode
Specifies what the ReadStage should do if any required blocks from the DataObject are missing from the memory cache.


digest

protected transient SecureHash digest
The digest of this ReadReq. Do NOT include this field in to_bytes.

Constructor Detail

ReadReq

protected ReadReq(VID target,
                  SecureHash tree_id,
                  Selection sel,
                  byte fault_mode)
Constructs a new ReadReq.


ReadReq

protected ReadReq(InputBuffer buffer)
           throws QSException
Constructs a ReadReq from its serialized form.

Method Detail

get_seq_num

public QSLong get_seq_num()
Returns the sequence number of the request.

Returns:
the sequence number of the request

get_target

public VID get_target()
Returns the id of the DataObject to read.


get_tree_id

public SecureHash get_tree_id()
Returns the GUID of the dissemination tree for the DataObject to read.


get_selection

public Selection get_selection()
Returns the Selection describing the read.


get_fault_mode

public byte get_fault_mode()
Returns the code for the fault mode.


get_digest

public SecureHash get_digest()
Returns the digest of this ReadReq.

WARNING: the first invocation of this method may be expensive, because it requires serializing the entire object.


serialize

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

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

hashCode

public int hashCode()
Returns the hash of the digest of this ReadReq.

WARNING: the first invocation of this method may be expensive, because it requires serializing the entire object.

Overrides:
hashCode in class Object

toString

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

Overrides:
toString in class Object