# `SquidMesh.Runtime.Journal`
[🔗](https://github.com/ccarvalho-eng/squid_mesh/blob/main/lib/squid_mesh/runtime/journal.ex#L1)

Jido.Storage boundary for Squid Mesh durable runtime facts.

The dispatch protocol owns the runtime fact schema. This module adapts those
facts into Jido thread entries and checkpoints so storage-backed runtime
slices can rebuild projections without reading the legacy runtime tables.

# `append_error`

```elixir
@type append_error() ::
  :empty_entries
  | {:mixed_threads, [SquidMesh.Runtime.DispatchProtocol.Entry.thread()]}
  | term()
```

# `loaded_thread`

```elixir
@type loaded_thread() :: %{
  thread: SquidMesh.Runtime.DispatchProtocol.Entry.thread(),
  thread_id: String.t(),
  rev: non_neg_integer(),
  entries: [SquidMesh.Runtime.DispatchProtocol.Entry.t()]
}
```

# `storage_config`

```elixir
@type storage_config() :: module() | {module(), keyword()}
```

# `append_entries`

```elixir
@spec append_entries(
  storage_config(),
  [SquidMesh.Runtime.DispatchProtocol.Entry.t()],
  keyword()
) ::
  {:ok, Jido.Thread.t()} | {:error, append_error()}
```

# `fetch_checkpoint`

```elixir
@spec fetch_checkpoint(
  storage_config(),
  SquidMesh.Runtime.DispatchProtocol.Entry.thread()
) ::
  {:ok, SquidMesh.Runtime.Journal.Checkpoint.t()} | {:error, term()}
```

# `load_entries`

```elixir
@spec load_entries(
  storage_config(),
  SquidMesh.Runtime.DispatchProtocol.Entry.thread()
) ::
  {:ok, [SquidMesh.Runtime.DispatchProtocol.Entry.t()]} | {:error, term()}
```

# `load_thread`

```elixir
@spec load_thread(storage_config(), SquidMesh.Runtime.DispatchProtocol.Entry.thread()) ::
  {:ok, loaded_thread()} | {:error, term()}
```

# `put_checkpoint`

```elixir
@spec put_checkpoint(
  storage_config(),
  SquidMesh.Runtime.DispatchProtocol.Entry.thread(),
  term(),
  non_neg_integer(),
  keyword()
) :: :ok | {:error, term()}
```

# `rebuild_dispatch_projection`

```elixir
@spec rebuild_dispatch_projection(storage_config(), String.t()) ::
  {:ok, SquidMesh.Runtime.DispatchProtocol.Projection.t()} | {:error, term()}
```

# `thread_id`

```elixir
@spec thread_id(SquidMesh.Runtime.DispatchProtocol.Entry.thread()) :: String.t()
```

---

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