Class TxnImpl

  • All Implemented Interfaces:
    Txn

    public class TxnImpl
    extends java.lang.Object
    implements Txn
    Build an etcd transaction.
    • Method Detail

      • newTxn

        public static TxnImpl newTxn​(java.util.function.Function<io.etcd.jetcd.api.TxnRequest,​java.util.concurrent.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 java.util.concurrent.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