Class TxnImpl

java.lang.Object
io.etcd.jetcd.op.TxnImpl
All Implemented Interfaces:
Txn

public class TxnImpl extends Object implements Txn
Build an etcd transaction.
  • Method Details

    • newTxn

      public static TxnImpl newTxn(Function<io.etcd.jetcd.api.TxnRequest,CompletableFuture<TxnResponse>> f, ByteSequence namespace)
    • If

      public TxnImpl If(Cmp... cmps)
      Description copied from interface: Txn
      takes a list of comparison. If all comparisons passed in succeed, the operations passed into Then() will be executed. Or the operations passed into Else() will be executed.
      Specified by:
      If in interface Txn
      Parameters:
      cmps - the comparisons
      Returns:
      this object
    • Then

      public TxnImpl Then(Op... ops)
      Description copied from interface: Txn
      takes a list of operations. The Ops list will be executed, if the comparisons passed in If() succeed.
      Specified by:
      Then in interface Txn
      Parameters:
      ops - the operations
      Returns:
      this object
    • Else

      public TxnImpl Else(Op... ops)
      Description copied from interface: Txn
      takes a list of operations. The Ops list will be executed, if the comparisons passed in If() fail.
      Specified by:
      Else in interface Txn
      Parameters:
      ops - the operations
      Returns:
      this object
    • commit

      public CompletableFuture<TxnResponse> commit()
      Description copied from interface: Txn
      tries to commit the transaction.
      Specified by:
      commit in interface Txn
      Returns:
      a TxnResponse wrapped in CompletableFuture