ostore.replica
Class ReplicaResp

java.lang.Object
  |
  +--ostore.replica.ReplicaResp
All Implemented Interfaces:
QueueElementIF, QuickSerializable
Direct Known Subclasses:
ReplicaCloseAllResp, ReplicaCloseResp, ReplicaCreateResp, ReplicaOpenResp, ReplicaReadResp, ReplicaUpdateResp

public abstract class ReplicaResp
extends Object
implements QueueElementIF, QuickSerializable

A superclass of all responses sent from the ReplicaStage back to the ClientStage or remote ReplicaStage.

Version:
$Id: ReplicaResp.java,v 1.16 2002/07/29 18:48:54 geels Exp $
Author:
Dennis Geels

Field Summary
protected  SecureHash digest
          The digest of this ReplicaResp.
protected  int error_code
          One of the error codes above (or NO_ERROR).
 boolean local
          true iff this ReplicaResp was constructed locally (not from its QuickSerializable form).
static int NO_ERROR
          An error code that indicates no error occurred.
static int NOT_OPEN
          An error code that indicates a close request failed because the replica was not open.
static int OBJECT_NOT_FOUND
          An error code that indicates a request failed because Tapestry could not find a replica of the data object.
static int READ_ERROR
          An error code that indicates a request failed because some portion of the requested data could not be read.
protected  SecureHash req_digest
          A digest of the corresponding ReplicaReq.
protected  SecureHash target
          The AGUID of the Replica from the original request.
static int VERSION_PREDICATE_NOT_SATISFIED
          An error code that indicates a request failed because no version satisfying the version predicate could be found.
 
Constructor Summary
protected ReplicaResp(InputBuffer buffer)
          Constructs a ReplicaResp from its serialized form.
protected ReplicaResp(ReplicaReq req, int error_code)
          Constructs a ReplicaResp for the specified ReplicaReq.
protected ReplicaResp(SecureHash req_digest, SecureHash target, int error_code)
          Constructs a new ReplicaResp.
 
Method Summary
 SecureHash get_digest()
          Returns the digest of this ReplicaResp.
 int get_error_code()
          Returns the error code.
 SecureHash get_req_digest()
          Returns the digest of the corresponding ReplicaReq.
 SecureHash get_target()
          Returns the AGUID from the original request.
 int hashCode()
          Returns the hash of the digest of this ReplicaResp.
 boolean is_local()
          Returns true if this ReplicaResp was sent from a local stage, false if it came off the network.
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 boolean successful()
          Returns true iff error_code() == NO_ERROR.
 String toString()
          Returns a human-readable representation of this ReplicaResp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_ERROR

public static final int NO_ERROR
An error code that indicates no error occurred.

See Also:
Constant Field Values

OBJECT_NOT_FOUND

public static final int OBJECT_NOT_FOUND
An error code that indicates a request failed because Tapestry could not find a replica of the data object.

See Also:
Constant Field Values

VERSION_PREDICATE_NOT_SATISFIED

public static final int VERSION_PREDICATE_NOT_SATISFIED
An error code that indicates a request failed because no version satisfying the version predicate could be found.

See Also:
Constant Field Values

READ_ERROR

public static final int READ_ERROR
An error code that indicates a request failed because some portion of the requested data could not be read. NOTE use this flag only if the original request specified that partial failure was unacceptable.

See Also:
Constant Field Values

NOT_OPEN

public static final int NOT_OPEN
An error code that indicates a close request failed because the replica was not open.

See Also:
Constant Field Values

req_digest

protected SecureHash req_digest
A digest of the corresponding ReplicaReq.


target

protected SecureHash target
The AGUID of the Replica from the original request.


error_code

protected int error_code
One of the error codes above (or NO_ERROR).


local

public final boolean local
true iff this ReplicaResp was constructed locally (not from its QuickSerializable form).


digest

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

Constructor Detail

ReplicaResp

protected ReplicaResp(SecureHash req_digest,
                      SecureHash target,
                      int error_code)
Constructs a new ReplicaResp.


ReplicaResp

protected ReplicaResp(ReplicaReq req,
                      int error_code)
Constructs a ReplicaResp for the specified ReplicaReq.


ReplicaResp

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

Method Detail

successful

public boolean successful()
Returns true iff error_code() == NO_ERROR.


get_error_code

public int get_error_code()
Returns the error code.


get_req_digest

public SecureHash get_req_digest()
Returns the digest of the corresponding ReplicaReq.

See Also:
get_digest()

get_target

public SecureHash get_target()
Returns the AGUID from the original request.


is_local

public boolean is_local()
Returns true if this ReplicaResp was sent from a local stage, false if it came off the network.


get_digest

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

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

See Also:
get_req_digest()

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 ReplicaResp.

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 ReplicaResp.

Overrides:
toString in class Object