org.apache.cassandra.db
Class TimestampClock

java.lang.Object
  extended by org.apache.cassandra.db.TimestampClock
All Implemented Interfaces:
IClock

public class TimestampClock
extends java.lang.Object
implements IClock

A simple clock composed of a timestamp. The comparison is the timestamp comparison.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.cassandra.db.IClock
IClock.ClockRelationship
 
Field Summary
static TimestampClock MIN_VALUE
           
static ICompactSerializer2<IClock> SERIALIZER
           
static TimestampClock ZERO_VALUE
           
 
Constructor Summary
TimestampClock(long timestamp)
           
 
Method Summary
 IClock.ClockRelationship compare(IClock other)
           
 boolean equals(java.lang.Object o)
           
 IClock getSuperset(java.util.List<IClock> otherClocks)
           
 int hashCode()
           
 void serialize(java.io.DataOutput out)
           
 int size()
           
 long timestamp()
           
 java.lang.String toString()
           
 ClockType type()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_VALUE

public static TimestampClock MIN_VALUE

ZERO_VALUE

public static TimestampClock ZERO_VALUE

SERIALIZER

public static ICompactSerializer2<IClock> SERIALIZER
Constructor Detail

TimestampClock

public TimestampClock(long timestamp)
Method Detail

timestamp

public long timestamp()

compare

public IClock.ClockRelationship compare(IClock other)
Specified by:
compare in interface IClock
Parameters:
other - Compare these two clocks.
Returns:
The relationship between the two clocks, lets us know if reconciliation will have to take place.

getSuperset

public IClock getSuperset(java.util.List<IClock> otherClocks)
Specified by:
getSuperset in interface IClock
Parameters:
otherClocks - The other clock to use when extracting the superset.
Returns:
The superset of the two clocks.

size

public int size()
Specified by:
size in interface IClock
Returns:
number of bytes this type of clock uses up when serialized.

type

public ClockType type()
Specified by:
type in interface IClock
Returns:
the type of this clock.

serialize

public void serialize(java.io.DataOutput out)
               throws java.io.IOException
Specified by:
serialize in interface IClock
Parameters:
out - Write a serialized representation of this clock to the output.
Throws:
java.io.IOException - Thrown if writing failed.

toString

public java.lang.String toString()
Specified by:
toString in interface IClock
Overrides:
toString in class java.lang.Object
Returns:
a textual representation of this clock.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2010 The Apache Software Foundation