barrel_design_publish (barrel_design v0.1.0)
View SourcePublished designs: the node's policy, the statements a database holds, their states, and which one a name follows.
Policy, from barrel_design's env:
published => #{accept_dbs => all | [Db], trust => [#{key_id, public_key, names => all | [Name], dbs => all | [SourceDb]}]}: the keys this node accepts statements from, each scoped to names and to source databases, and the receiving databases that accept any. A node also trusts its ownpublisherkey for statements signed for the same database.publisher => #{key_id, private_key => {file, Path} | Bytes, may_sign => #{Db | all => all | [Name]}}: the key this node signs with, and which names it signs for which database.
Statements rank by (version, action), publish < conflict < withdraw at one version. A name follows the maximum of its accepted mark and every trusted, valid statement received so far; two trusted publications of the same version with different manifests make it conflict(N), which only a statement ranked above N clears. A mark never goes down, so a restarted receiver never goes back.
Summary
Functions
What a name should follow, from its catalog record and its trusted statements: keep, {activate, Entry}, {withdraw, Entry}, {conflict, Version} or refuse (an active publication whose provenance the policy no longer accepts).
Whether this node signs name Name for database Db.
The module bytes a publication's attachments carry: all present and matching their names, or what is wrong.
This node's signing key: {ok, KeyId, PrivateKey}.
Every statement of the database, from the live versions of each barrel_design: document, deleted winners included: a live signed version can sit behind a deleted one. Each entry has its state under the policy (trusted still to be ordered, or why it is not). A database that closed meanwhile answers its error.
Whether the policy still accepts what an accepted publication was signed with: checked again from its provenance alone, so it holds after the statement itself is gone.
Types
-type entry() :: map().
Functions
What a name should follow, from its catalog record and its trusted statements: keep, {activate, Entry}, {withdraw, Entry}, {conflict, Version} or refuse (an active publication whose provenance the policy no longer accepts).
Whether this node signs name Name for database Db.
-spec module_bytes(binary(), entry()) -> {ok, #{binary() => binary()}} | waiting_for_modules | digest_mismatch.
The module bytes a publication's attachments carry: all present and matching their names, or what is wrong.
-spec policy() -> map().
This node's signing key: {ok, KeyId, PrivateKey}.
Every statement of the database, from the live versions of each barrel_design: document, deleted winners included: a live signed version can sit behind a deleted one. Each entry has its state under the policy (trusted still to be ordered, or why it is not). A database that closed meanwhile answers its error.
Whether the policy still accepts what an accepted publication was signed with: checked again from its provenance alone, so it holds after the statement itself is gone.