Expand description
Identity policy — when a document earns an id, and how one is minted.
Everything here is optional. The graph and mutation layers operate on paths
and never require an ID. This module decides when a document earns a
stable ID (the trigger set) and what that ID looks like (the mint).
Where IDs are stored is prov_graph::index; the Id type itself and the
well-formedness check over it are prov_graph::identity, because
resolving a link needs to recognize an id without being able to issue one.
The default is NoIdentity — identity off, no ID ever written. The
recommended lazy policy registers an ID only when something durably refers
to a document (a link-by-id or a publish), keeping the authoritative set as
small as possible.
Minting is random (opaque for free), with uniqueness enforced by rejection
against the index — including its tombstones, so a deleted document’s ID is
never reissued. An ID may contain, and begin with, a digit; anything
stamping one into metadata must keep it a string (see
prov-store’s edit::infer_scalar). The alphabet, check-character arithmetic,
and seeded PRNG all live in moid.
Structs§
- Id
- A stable, opaque document identifier.
- Minter
- The bundled minting policy: NOID xdigit + check IDs from a seeded PRNG.
- NoIdentity
- Identity disabled — the default. Paths only; no ID is ever minted or written.
- Registration
- Which events cause a document to be assigned (registered) an ID.
Enums§
- Trigger
- The registration event a caller is asking about (for example, a
workspace’s
registeroperation).
Constants§
- BLADE_
LEN - Total ID length: the random body plus one check character.
- BLADE_
RANDOM_ LEN - Random characters per ID (excluding the check character). 29^6 ≈ 595M — collision-free in practice for a workspace, enforced absolutely by mint-with-rejection.
- WORKSPACE_
NAME_ LEN - Total length of a minted workspace name:
WORKSPACE_NAME_RANDOM_LENplus the check character everymoidblade ends with. - WORKSPACE_
NAME_ RANDOM_ LEN - Random characters in a minted workspace name — twice a document blade’s
BLADE_RANDOM_LEN, for a different uniqueness problem.
Traits§
- Identity
Policy - A policy deciding when to register documents and how their IDs are minted.
Functions§
- mint_
workspace_ id - Mint an opaque global name for a workspace, randomizing from
seed. - verify
- Prov IDs use
BLADE_RANDOM_LENrandom NOID extended-digit characters plus a NOID check character. Minting lives inprov-identity; this crate only verifies IDs. Whetheridis a well-formed prov ID: correct length, alphabet-only, and a matching trailing check character. This is what catches a typo’dprov:link before it dangles silently.