# `Snodo.Extensions.Tasks.Snapshot`
[🔗](https://github.com/joshrotenberg/snodo/blob/v0.2.0/extensions/tasks/lib/snodo/extensions/tasks/snapshot.ex#L1)

A revisioned Task aggregate used at persistence and compare-and-set boundaries.

`work`, retry bookkeeping, `input_history`, and `accepted_input_responses` are
private execution state and are never projected onto the Tasks wire shape.
The original request for every lifetime-unique input key remains in
`input_history`, allowing a recovered worker to distinguish an identical
replay from an ambiguous key reuse. Accepted responses remain persisted when
no local worker is available.

# `retry_failure`

```elixir
@type retry_failure() :: map()
```

# `t`

```elixir
@type t() :: %Snodo.Extensions.Tasks.Snapshot{
  accepted_input_responses: %{optional(String.t()) =&gt; map()},
  input_history: %{optional(String.t()) =&gt; map()},
  last_failure: retry_failure() | nil,
  retry_at: String.t() | nil,
  retry_count: non_neg_integer(),
  revision: non_neg_integer(),
  task: Snodo.Extensions.Tasks.Task.t(),
  work: Snodo.Extensions.Tasks.Work.t() | nil
}
```

# `from_map`

```elixir
@spec from_map(term()) :: {:ok, t()} | {:error, term()}
```

Decodes and validates a persistence map produced by `to_map/1`.

# `new`

```elixir
@spec new(Snodo.Extensions.Tasks.Task.t(), Snodo.Extensions.Tasks.Work.t() | nil) ::
  t()
```

Creates the initial revision-zero snapshot for a durable Task.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Encodes the complete aggregate as a stable JSON-safe persistence map.

---

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