Package org.onosproject.store.service
Interface Transactional<T>
-
- All Known Subinterfaces:
AsyncConsistentMap<K,V>
,AsyncConsistentTreeMap<V>
,AsyncDocumentTree<V>
public interface Transactional<T>
Interface for transactional primitives.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompletableFuture<Version>
begin(TransactionId transactionId)
Begins the transaction.CompletableFuture<Void>
commit(TransactionId transactionId)
Commits a previously prepared transaction and unlocks the object.CompletableFuture<Boolean>
prepare(TransactionLog<T> transactionLog)
Prepares a transaction for commitment.CompletableFuture<Boolean>
prepareAndCommit(TransactionLog<T> transactionLog)
Prepares and commits a transaction.CompletableFuture<Void>
rollback(TransactionId transactionId)
Aborts a previously prepared transaction and unlocks the object.
-
-
-
Method Detail
-
begin
CompletableFuture<Version> begin(TransactionId transactionId)
Begins the transaction.- Parameters:
transactionId
- the transaction identifier for the transaction to begin- Returns:
- a completable future to be completed with the lock version
-
prepare
CompletableFuture<Boolean> prepare(TransactionLog<T> transactionLog)
Prepares a transaction for commitment.- Parameters:
transactionLog
- transaction log- Returns:
true
if prepare is successful and transaction is ready to be committedfalse
otherwise
-
prepareAndCommit
CompletableFuture<Boolean> prepareAndCommit(TransactionLog<T> transactionLog)
Prepares and commits a transaction.- Parameters:
transactionLog
- transaction log- Returns:
true
if prepare is successful and transaction was committedfalse
otherwise
-
commit
CompletableFuture<Void> commit(TransactionId transactionId)
Commits a previously prepared transaction and unlocks the object.- Parameters:
transactionId
- transaction identifier- Returns:
- future that will be completed when the operation finishes
-
rollback
CompletableFuture<Void> rollback(TransactionId transactionId)
Aborts a previously prepared transaction and unlocks the object.- Parameters:
transactionId
- transaction identifier- Returns:
- future that will be completed when the operation finishes
-
-