barrel_provenance (barrel_docdb v1.1.1)

View Source

Write provenance: who made a write. A validated, size-capped map of actor, session, and source binaries supplied through the provenance write option, persisted as a CBOR blob in the current entity (last writer) and in every retained history entry (the audit record). Local-only in v1: provenance does not ride the sync wire; replicated arrivals are attributed by their history cause and the origin's source id.

Summary

Functions

Decode a stored provenance blob back to the API map shape.

Encode a provenance map to its stored CBOR form.

Validate a caller-supplied provenance map and return its encoded form. Keys are limited to actor/session/source, values are binaries of at most 256 bytes, and the encoded blob is capped at 1024 bytes. Error terms never echo the values.

Types

provenance/0

-type provenance() :: #{actor => binary(), session => binary(), source => binary()}.

Functions

decode(Bin)

-spec decode(binary()) -> provenance().

Decode a stored provenance blob back to the API map shape.

encode(Prov)

-spec encode(provenance()) -> binary().

Encode a provenance map to its stored CBOR form.

validate(Prov)

-spec validate(term()) -> {ok, binary()} | {error, term()}.

Validate a caller-supplied provenance map and return its encoded form. Keys are limited to actor/session/source, values are binaries of at most 256 bytes, and the encoded blob is capped at 1024 bytes. Error terms never echo the values.