# `Issho.Transaction`
[🔗](https://github.com/hattoriai/issho/blob/v0.1.0/lib/issho/transaction.ex#L1)

The envelope of a change to a document, the same for every engine:

    %{
      "id" => "4f1c…",          # unique, chosen by the author; a retry reuses it
      "epoch" => "9a0b…",       # the document's epoch the author saw
      "base_revision" => 41,    # the revision the author saw
      "ops" => [...]            # the engine's operations, opaque to Issho
    }

The authority gives each accepted transaction the next revision and its
author, and keeps a receipt of its id: the same transaction sent again
(after a lost reply, or from an offline queue) is answered with its
revision and applied once. A different transaction with an id already
used is refused.

# `t`

```elixir
@type t() :: %{required(String.t()) =&gt; term()}
```

# `check`

```elixir
@spec check(term(), String.t(), non_neg_integer()) :: :ok | {:error, atom()}
```

Checks a transaction's envelope against the document's epoch and
revision.

# `digest`

```elixir
@spec digest(t(), String.t()) :: String.t()
```

A digest of what a transaction does and who made it, to tell a retry
from a different transaction that reuses an id.

# `id`

```elixir
@spec id() :: String.t()
```

A new random id, for epochs and transactions.

# `max_ops`

```elixir
@spec max_ops() :: pos_integer()
```

The most operations in one transaction.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
