ExGAM.Ledger.Store.ETS (ExGAM v0.1.0)

Copy Markdown View Source

Volatile ETS Store for Domain ledgers.

One GenServer owns a protected ETS table and serializes compare-and-swap transitions. A batch becomes acknowledged only in the same callback that installs every linked Entry and its idempotency index. This adapter is intended for development, tests, and ephemeral Domains; it makes no durability claim across owner-process failure.

Cursors, Entries and batch identities occupy separate rows. Appending or looking up an identity never copies prior history onto the owner's heap; only load/export reconstruct a complete snapshot. One ETS insert publishes the new Entries, cursor and batch identity together.

:compressed (default false) trades per-row encoding/decoding work for a smaller table. It does not change batch visibility or durability guarantees.

:fault_injection (or :fault) may be set to :before_commit or :after_commit. Both return {:error, :ambiguous}; the latter installs the batch first, allowing recovery code to exercise identity lookup.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts an empty volatile ledger Store.

Types

append_context()

@type append_context() :: %{
  revision: non_neg_integer(),
  head_digest: ExGAM.Ledger.Entry.digest(),
  batches: %{optional(String.t()) => ExGAM.Ledger.batch_info()}
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts an empty volatile ledger Store.