# `MedEx.Storage`
[🔗](https://github.com/nshkrdotcom/med_ex/blob/med_ex-v0.2.0/components/core/med_capture/lib/med_ex/storage.ex#L1)

A single temporary writer owns its adapter state. A commit receipt names the
synchronized journal generation and its exclusive sequence/sample boundaries.
An unclassified IO error after appending begins is an unknown outcome.

# `result`

```elixir
@type result() ::
  {:ok, state(), map()} | {:error, {:not_committed | :outcome_unknown, term()}}
```

# `state`

```elixir
@type state() :: term()
```

# `close`

```elixir
@callback close(state()) :: term()
```

# `commit_batch`

```elixir
@callback commit_batch(state(), {:frames, [MedEx.SampleFrame.t()]} | {:gap, map()}) ::
  result()
```

# `lookup`

```elixir
@callback lookup(state(), :frame | :gap, term()) :: {:ok, binary()} | :missing
```

# `open`

```elixir
@callback open(keyword()) :: result()
```

# `recover`

```elixir
@callback recover(Path.t(), keyword()) :: {:ok, map()} | {:error, term()}
```

# `seal`

```elixir
@callback seal(state(), :finished | :interrupted | :failed, binary() | %{conflict: map()}) ::
  {:ok, MedEx.StreamIndex.t()} | {:error, term()}
```

# `usage`

```elixir
@callback usage(state()) :: %{
  raw_bytes: non_neg_integer(),
  frame_count: non_neg_integer(),
  span_count: non_neg_integer(),
  journal_bytes: non_neg_integer()
}
```

---

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