Package org.apache.accumulo.core.fate
Interface TStore<T>
-
- All Superinterfaces:
ReadOnlyTStore<T>
- All Known Implementing Classes:
AgeOffStore
,ZooStore
public interface TStore<T> extends ReadOnlyTStore<T>
Transaction Store: a place to save transactions A transaction consists of a number of operations. To use, first create a transaction id, and then seed the transaction with an initial operation. An executor service can then execute the transaction's operation, possibly pushing more operations onto the transaction as each step successfully completes. If a step fails, the stack can be unwound, undoing each operation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.accumulo.core.fate.ReadOnlyTStore
ReadOnlyTStore.TStatus
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
create()
Create a new transaction idvoid
delete(long tid)
Remove the transaction from the store.void
pop(long tid)
Remove the last pushed operation from the given transaction.void
push(long tid, Repo<T> repo)
Update the given transaction with the next operationvoid
setStatus(long tid, ReadOnlyTStore.TStatus status)
Update the state of a given transactionvoid
setTransactionInfo(long tid, Fate.TxInfo txInfo, Serializable val)
Set transaction-specific information.Repo<T>
top(long tid)
Get the current operation for the given transaction id.boolean
tryReserve(long tid)
Attempt to reserve transaction-
Methods inherited from interface org.apache.accumulo.core.fate.ReadOnlyTStore
getStack, getStatus, getTransactionInfo, list, reserve, reserve, timeCreated, unreserve, waitForStatusChange
-
-
-
-
Method Detail
-
create
long create()
Create a new transaction id- Returns:
- a transaction id
-
top
Repo<T> top(long tid)
Description copied from interface:ReadOnlyTStore
Get the current operation for the given transaction id. Caller must have already reserved tid.- Specified by:
top
in interfaceReadOnlyTStore<T>
- Parameters:
tid
- transaction id, previously reserved.- Returns:
- a read-only view of the operation
-
push
void push(long tid, Repo<T> repo) throws StackOverflowException
Update the given transaction with the next operation- Parameters:
tid
- the transaction idrepo
- the operation- Throws:
StackOverflowException
-
pop
void pop(long tid)
Remove the last pushed operation from the given transaction.
-
setStatus
void setStatus(long tid, ReadOnlyTStore.TStatus status)
Update the state of a given transaction- Parameters:
tid
- transaction idstatus
- execution status
-
setTransactionInfo
void setTransactionInfo(long tid, Fate.TxInfo txInfo, Serializable val)
Set transaction-specific information.- Parameters:
tid
- transaction idtxInfo
- name of attribute of a transaction to set.val
- transaction data to store
-
delete
void delete(long tid)
Remove the transaction from the store.- Parameters:
tid
- the transaction id
-
tryReserve
boolean tryReserve(long tid)
Attempt to reserve transaction- Parameters:
tid
- transaction id- Returns:
- true if reserved by this call, false if already reserved
-
-