SquidMesh.Runtime.Journal (squid_mesh v0.1.0-alpha.7)

Copy Markdown View Source

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.

Summary

Types

append_error()

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

loaded_thread()

@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()

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

Functions

append_entries(storage, entries, opts \\ [])

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

fetch_checkpoint(storage, thread)

load_entries(storage, thread)

load_thread(storage, thread)

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

put_checkpoint(storage, thread, projection, thread_rev, opts \\ [])

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

rebuild_dispatch_projection(storage, queue)

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

thread_id(arg)