Package 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
Nested Classes Modifier and Type Interface Description static classReadOnlyTStore.TStatusPossible operational status codes.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SerializablegetProperty(long tid, String prop)Retrieve a transaction-specific property.List<ReadOnlyRepo<T>>getStack(long tid)Get all operations on a transactions stack.ReadOnlyTStore.TStatusgetStatus(long tid)Get the state of a given transaction.List<Long>list()list all transaction ids in store.longreserve()Reserve a transaction that is IN_PROGRESS or FAILED_IN_PROGRESS.voidreserve(long tid)Reserve the specific tid.ReadOnlyRepo<T>top(long tid)Get the current operation for the given transaction id.voidunreserve(long tid, long deferTime)Return the given transaction to the store.ReadOnlyTStore.TStatuswaitForStatusChange(long tid, EnumSet<ReadOnlyTStore.TStatus> expected)Wait for the status 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 thereservemethod. 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
-
getStack
List<ReadOnlyRepo<T>> getStack(long tid)
Get all operations on a transactions stack. Element 0 contains the most recent operation pushed or the top.
-
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 status 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.
-
-