Durable, disposable Domain read model beside the canonical ledger.
A generation is rebuilt by a trusted Domain from verified ledger batches.
commit/5 atomically applies row changes and advances its exact predecessor
cursor. Readers specify that cursor: stale pages are errors, never mixed
revisions. A persisted projection is not authenticated by its head digest;
cold recovery must rebuild it from the ledger before using it for authority.
Keys are {collection, identity}. Writes receive typed values; adapters encode
them through Rows. Reads return canonical bytes, not a serialized process or
a full-state snapshot. No PID, timer,
capability, execution secret or callback belongs here. Implementations must
distinguish absence from storage failure and support indexed bounded reads.
Summary
Callbacks
Applies all changes atomically at the expected generation and cursor, then advances the cursor.
Reads the canonical bytes of existing keys at one exact generation and cursor.
Reads the active generation and its committed cursor, or returns :not_found.
Opens a fresh projection generation for a Domain and fences its earlier generation.
Reads a count- and byte-bounded page of one collection at an exact cursor.
Reads an indexed selection using query options followed by the original adapter options.
Functions
Commits row changes from the supplied predecessor cursor to the new cursor.
Fetches selected rows as canonical bytes at the requested projection cursor.
Reads the projection head for a Domain through its configured adapter.
Creates a fresh generation through the configured projection adapter.
Pages over a collection using :limit, :max_bytes and an opaque :after cursor.
Types
Callbacks
Applies all changes atomically at the expected generation and cursor, then advances the cursor.
@callback fetch(handle(), cursor(), [key()], keyword()) :: {:ok, %{optional(key()) => binary()}} | {:error, term()}
Reads the canonical bytes of existing keys at one exact generation and cursor.
Reads the active generation and its committed cursor, or returns :not_found.
Opens a fresh projection generation for a Domain and fences its earlier generation.
Reads a count- and byte-bounded page of one collection at an exact cursor.
Reads an indexed selection using query options followed by the original adapter options.
Functions
Commits row changes from the supplied predecessor cursor to the new cursor.
@spec fetch(config(), handle(), cursor(), [key()]) :: {:ok, %{optional(key()) => binary()}} | {:error, term()}
Fetches selected rows as canonical bytes at the requested projection cursor.
Reads the projection head for a Domain through its configured adapter.
Creates a fresh generation through the configured projection adapter.
Pages over a collection using :limit, :max_bytes and an opaque :after cursor.
:group, :from, :through and :nearest select indexed queries via the
adapter's select/5 callback. A nil cursor in the reply marks the last page.