io.etcd.jetcd.op

## 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 Summary

All Methods Static Methods Instance Methods Concrete Methods
`CompletableFuture<TxnResponse>` `commit()` tries to commit the transaction.
`TxnImpl` `Else(Op... ops)` takes a list of operations.
`TxnImpl` `If(Cmp... cmps)` takes a list of comparison.
`static TxnImpl` `newTxn(Function<TxnRequest,CompletableFuture<TxnResponse>> f, ByteSequence namespace)`
`TxnImpl` `Then(Op... ops)` takes a list of operations.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### newTxn

    public static TxnImpl newTxn(Function<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`

#### 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`

#### 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`

#### 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