# `Jido.Storage.ETS`
[🔗](https://github.com/agentjido/jido/blob/v2.3.0/lib/jido/storage/ets.ex#L1)

ETS-based storage adapter for agent checkpoints and thread journals.

Fast in-memory storage for development and testing. Not restart-safe -
all data is lost when the BEAM stops.

## Usage

    defmodule MyApp.Jido do
      use Jido,
        otp_app: :my_app,
        storage: {Jido.Storage.ETS, table: :my_jido_storage}
    end

## Options

- `:table` - Base table name (default: `:jido_storage`). Creates three tables:
  - `{table, :checkpoints}` - Agent checkpoint data (set)
  - `{table, :threads}` - Thread entries ordered by `{thread_id, seq}` (ordered_set)
  - `{table, :thread_meta}` - Thread metadata (set)

## Concurrency

Thread operations use atomic ETS operations. The `expected_rev` option in
`append_thread/3` provides optimistic concurrency control.

# `opts`

```elixir
@type opts() :: keyword()
```

# `append_thread`

```elixir
@spec append_thread(String.t(), [Jido.Thread.Entry.t()], opts()) ::
  {:ok, Jido.Thread.t()} | {:error, term()}
```

Append entries to a thread.

## Options

- `:expected_rev` - If provided, the append will fail with `{:error, :conflict}`
  if the current thread revision doesn't match.
- `:metadata` - Thread metadata to merge (only used when creating new thread).

# `delete_checkpoint`

```elixir
@spec delete_checkpoint(term(), opts()) :: :ok | {:error, term()}
```

Delete a checkpoint by key.

# `delete_thread`

```elixir
@spec delete_thread(String.t(), opts()) :: :ok | {:error, term()}
```

Delete a thread and all its entries.

# `get_checkpoint`

```elixir
@spec get_checkpoint(term(), opts()) :: {:ok, term()} | :not_found | {:error, term()}
```

Retrieve a checkpoint by key.

Returns `{:ok, data}` if found, `:not_found` otherwise.

# `load_thread`

```elixir
@spec load_thread(String.t(), opts()) ::
  {:ok, Jido.Thread.t()} | :not_found | {:error, term()}
```

Load a thread by ID, reconstructing from stored entries.

Returns `{:ok, thread}` if entries exist, `:not_found` otherwise.

# `put_checkpoint`

```elixir
@spec put_checkpoint(term(), term(), opts()) :: :ok | {:error, term()}
```

Store a checkpoint, overwriting any existing value.

