org.apache.accumulo.fate
Interface ReadOnlyTStore<T>

All Known Subinterfaces:
TStore<T>
All Known Implementing Classes:
AgeOffStore, ReadOnlyStore, ZooStore

public interface ReadOnlyTStore<T>

Read only access to a Transaction Store. A transaction consists of a number of operations. Instances of this class may check on the queue of outstanding transactions but may neither modify them nor create new ones.


Nested Class Summary
static class ReadOnlyTStore.TStatus
          Possible operational status codes.
 
Method Summary
 Serializable getProperty(long tid, String prop)
          Retrieve a transaction-specific property.
 ReadOnlyTStore.TStatus getStatus(long tid)
          Get the state of a given transaction.
 List<Long> list()
          list all transaction ids in store.
 long reserve()
          Reserve a transaction that is IN_PROGRESS or FAILED_IN_PROGRESS.
 void reserve(long tid)
          Reserve the specific tid.
 ReadOnlyRepo<T> top(long tid)
          Get the current operation for the given transaction id.
 void unreserve(long tid, long deferTime)
          Return the given transaction to the store.
 ReadOnlyTStore.TStatus waitForStatusChange(long tid, EnumSet<ReadOnlyTStore.TStatus> expected)
          Wait for the satus of a transaction to change
 

Method Detail

reserve

long reserve()
Reserve a transaction that is IN_PROGRESS or FAILED_IN_PROGRESS. Reserving a transaction id ensures that nothing else in-process interacting via the same instance will be operating on that transaction id.

Returns:
a transaction id that is safe to interact with, chosen by the store.

reserve

void reserve(long tid)
Reserve the specific tid. Reserving a transaction id ensures that nothing else in-process interacting via the same instance will be operating on that transaction id.


unreserve

void unreserve(long tid,
               long deferTime)
Return the given transaction to the store. upon successful return the store now controls the referenced transaction id. caller should no longer interact with it.

Parameters:
tid - transaction id, previously reserved.
deferTime - time in millis to keep this transaction out of the pool used in the reserve method. must be non-negative.

top

ReadOnlyRepo<T> top(long tid)
Get the current operation for the given transaction id. Caller must have already reserved tid.

Parameters:
tid - transaction id, previously reserved.
Returns:
a read-only view of the operation

getStatus

ReadOnlyTStore.TStatus getStatus(long tid)
Get the state of a given transaction. Caller must have already reserved tid.

Parameters:
tid - transaction id, previously reserved.
Returns:
execution status

waitForStatusChange

ReadOnlyTStore.TStatus waitForStatusChange(long tid,
                                           EnumSet<ReadOnlyTStore.TStatus> expected)
Wait for the satus of a transaction to change

Parameters:
tid - transaction id, need not have been reserved.
expected - a set of possible statuses we are interested in being notified about. may not be null.
Returns:
execution status.

getProperty

Serializable getProperty(long tid,
                         String prop)
Retrieve a transaction-specific property. Caller must have already reserved tid.

Parameters:
tid - transaction id, previously reserved.
prop - name of property to retrieve.

list

List<Long> list()
list all transaction ids in store.

Returns:
all outstanding transactions, including those reserved by others.


Copyright © 2015 Apache Accumulo Project. All rights reserved.