Chronicle.Identity protocol (chronicle v0.1.0)

Copy Markdown

Converts domain values into small, stable audit references.

A protocol rather than a behaviour because the thing that varies is the shape of the data, not a choice of implementation — actors and subjects arrive as schema structs, plain maps, and application types that share nothing but the need to be named.

The Any fallback tries the shapes worth guessing at and then raises. It does not fall back to inspect/1 or to a generated id: a reference that looks plausible but points at nothing is worse than a write that stops and tells you the value it could not name. Chronicle.ref/2 is the explicit way through for values that genuinely have no derivable identity.

Whatever this returns is reduced to exactly one shape, {type, id}, by Chronicle.Reference — so there is a single place where reference identity is decided, and a composite key is digested rather than stored two ways.

Summary

Types

t()

All the types that implement this protocol.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

audit_identity(value)

@spec audit_identity(t()) :: map()