org.apache.accumulo.server.fate
Interface TStore<T>

All Known Implementing Classes:
ZooStore

public interface TStore<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
static class TStore.TStatus
           
 
Method Summary
 long create()
          Create a new transaction id
 void delete(long tid)
          Remove the transaction from the store.
 Serializable getProperty(long tid, String prop)
           
 TStore.TStatus getStatus(long tid)
          Get the state of a given transaction.
 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 operation
 long reserve()
          Reserve a transaction that is IN_PROGRESS or FAILED_IN_PROGRESS.
 void reserve(long tid)
           
 void setProperty(long tid, String prop, Serializable val)
           
 void setStatus(long tid, TStore.TStatus status)
          Update the state of a given transaction
 Repo<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
 TStore.TStatus waitForStatusChange(long tid, EnumSet<TStore.TStatus> expected)
          Wait for the satus of a transaction to change
 

Method Detail

create

long create()
Create a new transaction id

Returns:
a transaction id

reserve

long reserve()
Reserve a transaction that is IN_PROGRESS or FAILED_IN_PROGRESS.


reserve

void reserve(long tid)

unreserve

void unreserve(long tid,
               long deferTime)
Return the given transaction to the store

Parameters:
tid -
deferTime -

top

Repo<T> top(long tid)
Get the current operation for the given transaction id.

Parameters:
tid - transaction id
Returns:
the operation

push

void push(long tid,
          Repo<T> repo)
          throws StackOverflowException
Update the given transaction with the next operation

Parameters:
tid - the transaction id
repo - the operation
Throws:
StackOverflowException

pop

void pop(long tid)
Remove the last pushed operation from the given transaction.

Parameters:
tid -

getStatus

TStore.TStatus getStatus(long tid)
Get the state of a given transaction.

Parameters:
tid - transaction id
Returns:
execution status

setStatus

void setStatus(long tid,
               TStore.TStatus status)
Update the state of a given transaction

Parameters:
tid - transaction id
status - execution status

waitForStatusChange

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

Parameters:
tid - transaction id

setProperty

void setProperty(long tid,
                 String prop,
                 Serializable val)

getProperty

Serializable getProperty(long tid,
                         String prop)

delete

void delete(long tid)
Remove the transaction from the store.

Parameters:
tid - the transaction id


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.