fabric.store
Class ReadHistory

java.lang.Object
  extended by fabric.store.ReadHistory

public class ReadHistory
extends java.lang.Object

This class is responsible for keeping a log of the recent reads, for checking commit conflicts. Each read has a time associated with it, and the log only keeps the most recent entries.


Field Summary
static long DEFAULT_LENGTH
          the default length of a read history, in milliseconds
 
Constructor Summary
ReadHistory()
           
ReadHistory(long length, long beginning)
          create a new read history with duration length
 
Method Summary
 boolean check(long oid, long time)
          determine whether preparing an update to an object at a given time would cause a conflict with any reads that have occurred since that time.
 void record(PrepareRequest req)
          record a prepare request in the history
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LENGTH

public static final long DEFAULT_LENGTH
the default length of a read history, in milliseconds

See Also:
Constant Field Values
Constructor Detail

ReadHistory

public ReadHistory()

ReadHistory

public ReadHistory(long length,
                   long beginning)
create a new read history with duration length

Parameters:
length - the duration, in milliseconds, of entries in the history
beginning - a time such that no reads have happened since that time (typically now)
Method Detail

record

public void record(PrepareRequest req)
record a prepare request in the history


check

public boolean check(long oid,
                     long time)
determine whether preparing an update to an object at a given time would cause a conflict with any reads that have occurred since that time.

Parameters:
oid - the object to check
time - the commit time
Returns:
true if the object is safe to prepare