ExGAM.Domain.Command.Record (ExGAM v0.1.0)

Copy Markdown View Source

Exact-identity recovery shared by durable single-record commands.

Scope, Presentation and Outcome commands have different validation and event semantics, but the same idempotency rule: an existing reference is reusable only when the complete normalized record is equal. After a successful append, absence or a different record is a fatal recovery contradiction.

This module deliberately does not build events, choose collections or append to the ledger. Those responsibilities remain explicit in each command.

Summary

Functions

Looks up one normalized record under exact identity semantics.

Returns an exact recovered record or halts state on a contradiction.

Types

lookup(record)

@type lookup(record) :: {:ok, record} | :not_found | {:error, term()}

Functions

lookup(index, expected, conflict)

@spec lookup(map(), struct(), atom()) :: lookup(struct())

Looks up one normalized record under exact identity semantics.

recover(state, projection, index, expected, conflict, missing)

Returns an exact recovered record or halts state on a contradiction.