ostore.inner
Class Heartbeat

java.lang.Object
  |
  +--ostore.inner.Heartbeat
All Implemented Interfaces:
Comparable, QuickSerializable

public class Heartbeat
extends Object
implements QuickSerializable, Comparable

A heartbeat is a signed certificate from the Inner Ring indicating when a given version of an OceanStore data object was created. This class is actually rather mis-named, since there are several different ``classes'' of ``heartbeats'' in OceanStore, all of which fall under the broad description of ``heartbeat''. This class contains the data which is common to all of them. Some classes which actually serve as signed certificates of this data are

The reason for this rather complex state of affairs is that generating a heartbeat requires the creation of a digital signature over the signed data, and doing this in the inner ring requires a Byzantine agreement to occur. Thus a fresh heartbeat requires as much computation time and network bandwidth as a small write--a non-trivial amount. So whenever possible, the Inner Ring servers try to give out already computed heartbeats rather than create new ones. For example, the message TimedHeartbeatReqMsg can be used to ask the Inner Ring for any heartbeat with a timestamp later than a certain value. The reply message, TimedHeartbeatRespMsg


Field Summary
 SecureHash aguid
           
 QSDate expiration_date
          The official time that this version will expire.
 long seq_num
          The index of this version of the object.
 QSDate timestamp
          The official time that this version was written.
 SecureHash vguid
           
 SecureHash vhash
           
 
Constructor Summary
Heartbeat(InputBuffer buffer)
           
Heartbeat(SecureHash aguid, SecureHash vhash, SecureHash vguid, long seq_num, QSDate timestamp)
          Constructs a Heartbeat which does not expire.
Heartbeat(SecureHash aguid, SecureHash vhash, SecureHash vguid, long seq_num, QSDate timestamp, QSDate expiration_date)
          Constructs a Heartbeat.
 
Method Summary
 int compareTo(Object o)
          Compares this Heartbeat to another.
 boolean equals(Object other)
           
static Heartbeat extract_hb(SignedQS signed_hb, SecureHash aguid)
           
 int hashCode()
           
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

aguid

public SecureHash aguid

vhash

public SecureHash vhash

vguid

public SecureHash vguid

seq_num

public long seq_num
The index of this version of the object.


timestamp

public QSDate timestamp
The official time that this version was written.


expiration_date

public QSDate expiration_date
The official time that this version will expire. This field may be set when the writer has a good idea how long this version will remain reasonable "current" (cf. http headers.

Constructor Detail

Heartbeat

public Heartbeat(SecureHash aguid,
                 SecureHash vhash,
                 SecureHash vguid,
                 long seq_num,
                 QSDate timestamp)
Constructs a Heartbeat which does not expire. Technically, the version will expire on the last possible recorded second, at
Sun Aug 17 00:12:55 PDT 292278994
.


Heartbeat

public Heartbeat(SecureHash aguid,
                 SecureHash vhash,
                 SecureHash vguid,
                 long seq_num,
                 QSDate timestamp,
                 QSDate expiration_date)
Constructs a Heartbeat.


Heartbeat

public Heartbeat(InputBuffer buffer)
          throws QSException
Method Detail

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class 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

toString

public String toString()
Overrides:
toString in class Object

extract_hb

public static Heartbeat extract_hb(SignedQS signed_hb,
                                   SecureHash aguid)

compareTo

public int compareTo(Object o)
Compares this Heartbeat to another. This method compares the fields of the Heartbeats in the following order:
  1. seq_num
  2. timestamp
  3. vguid
  4. expiration_date
.

Specified by:
compareTo in interface Comparable