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 java.util.concurrent.CompletableFuture<Version>
begin(TransactionId transactionId)
Begins the transaction.java.util.concurrent.CompletableFuture<java.lang.Void>
commit(TransactionId transactionId)
Commits a previously prepared transaction and unlocks the object.java.util.concurrent.CompletableFuture<java.lang.Boolean>
prepare(TransactionLog<T> transactionLog)
Prepares a transaction for commitment.java.util.concurrent.CompletableFuture<java.lang.Boolean>
prepareAndCommit(TransactionLog<T> transactionLog)
Prepares and commits a transaction.java.util.concurrent.CompletableFuture<java.lang.Void>
rollback(TransactionId transactionId)
Aborts a previously prepared transaction and unlocks the object.
-
-
-
Method Detail
-
begin
java.util.concurrent.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
java.util.concurrent.CompletableFuture<java.lang.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
java.util.concurrent.CompletableFuture<java.lang.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
java.util.concurrent.CompletableFuture<java.lang.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
java.util.concurrent.CompletableFuture<java.lang.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
-
-