ostore.util
Class VID

java.lang.Object
  |
  +--ostore.util.VID
All Implemented Interfaces:
Comparable, QuickSerializable

public class VID
extends Object
implements QuickSerializable, Comparable

A wrapper class for a DataObject version identifier. A VID contains a single SecureHash, which is either the VHash of a top-block, the VGUID of a top-block, or the GUID of a log object (LGUID). VID is also used to refer to the archival for of a DataObject, a disseminatable (DISS) (e.g. fragment or tombstone).

Version:
$Id: VID.java,v 1.17 2004/03/23 07:42:10 hweather Exp $
Author:
Dennis Geels

Field Summary
static byte DISS
          The type code for a VID that consists of the DISS of the archival form of a DataObject block.
static byte LGUID
          The type code for a VID that consists of the GUID of the log object for a version.
static String[] STRING
           
static byte VGUID
          The type code for a VID that consists of the VGUID of a DataObject's top block (A checkpoint GUID).
static byte VHASH
          The type code for a VID that consists of the VHash of a DataObject's top block.
 
Constructor Summary
VID(byte type, SecureHash id)
          Constructs a new VID.
VID(InputBuffer buffer)
          Constructs a VID from its QuickSerializable form.
 
Method Summary
 int compareTo(Object o)
          Imposes an order on VIDs.
 boolean equals(Object other)
          Tests for equality (type and id).
 SecureHash get_id()
          Returns the VHash, VGUID, or GUID, as appropriate.
 byte get_type()
          Returns the type of identifier for this VID.
 int hashCode()
          Returns the hashcode of the internal identifier.
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 String toString()
          Returns a human-readable representation of this VID.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VHASH

public static final byte VHASH
The type code for a VID that consists of the VHash of a DataObject's top block.

See Also:
Constant Field Values

VGUID

public static final byte VGUID
The type code for a VID that consists of the VGUID of a DataObject's top block (A checkpoint GUID).

See Also:
Constant Field Values

LGUID

public static final byte LGUID
The type code for a VID that consists of the GUID of the log object for a version.

See Also:
Constant Field Values

DISS

public static final byte DISS
The type code for a VID that consists of the DISS of the archival form of a DataObject block.

See Also:
Constant Field Values

STRING

public static final String[] STRING
Constructor Detail

VID

public VID(byte type,
           SecureHash id)
Constructs a new VID.


VID

public VID(InputBuffer buffer)
    throws QSException
Constructs a VID from its QuickSerializable form.

Method Detail

get_type

public byte get_type()
Returns the type of identifier for this VID.

Returns:
One of VHASH, VGUID, LGUID, DISS

get_id

public SecureHash get_id()
Returns the VHash, VGUID, or GUID, as appropriate.


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

compareTo

public int compareTo(Object o)
Imposes an order on VIDs. The order is equivalent to the lexicographic order on corresponding VID.get_type(),VID.get_id() pairs.

Specified by:
compareTo in interface Comparable

hashCode

public int hashCode()
Returns the hashcode of the internal identifier.

Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Tests for equality (type and id).

Overrides:
equals in class Object
Parameters:
other - possibly a VID.
Returns:
true iff other is a VID with the same identifier (including type).

toString

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

Overrides:
toString in class Object