Expand description
The partition metadata record and provisioning API — format v3.
Implements the “partition record and provisioning” sections of
the design spec (the format-reservations spec,
§3, §4). Deliberately scoped to exactly that: this module does not
touch the pack/idx entry layout (§1, §2) and does not add context or
key_epoch fields to any packed byte — those stay gated on the open
(hash, context) ruling and land in a later change.
Two files, at two different levels, because two different things are recorded and only one of them should ever leave the machine:
<store_root>/
partitions.local.json — LOCAL subject bindings, store-level.
NEVER replicated. NEVER inside any
partition directory.
<partition_id_hex>/
partition.json — the PORTABLE partition record.
active/ packs/ manifests/The guarantee this schema exists to make structural, not aspirational:
retention must reach a person partition identically to a household
partition. PartitionStore loads
PartitionRecord (portable: retention class, key epoch, timestamps)
but never loads or holds a Subject — subject is read only inside
crate::store::PartitionStore::create, to verify the derivation, and
is then written straight to the store-level local-binding file. No
accessor on PartitionStore returns a Subject. Any future code that
wants retention (or anything else) to behave differently for a person
than a household would have to change a function signature to reach
the subject at all — a visible act with an owner, not a quiet
conditional.
Structs§
- Local
Binding - One entry in the store-level
LOCAL_BINDINGS_FILE: the subject a partition was provisioned for, plus a free-text label. Never parsed for semantics beyondsubject. - Partition
Key - The reserved key-material slot inside
PartitionRecord.kek_refandkek_schemeare opaque and unresolved today — storage-kit never parses, resolves, or logs either field. Both arenulluntil the key hierarchy lands (the security review, concurrent, out of scope here); a non-null value is rejected on read, fail-closed, the same discipline as the pack/idx reserved fields. - Partition
Record partition.json— the portable partition record. Replicated verbatim with the data (spec §3.2): retention class and key state are properties of the bytes, not of the store root they happen to sit in today.- Partition
Spec - Input to
crate::store::PartitionStore::create. Deliberately carries no default retention class and no default encryption mode: both fields are required, so a caller must choose. “Retention decided before ingest, not retrofitted” cannot be enforced by a constructor that silently fills one in — the same discipline applies toencryption_mode, which is the field that makes sealed-by-default fail closed rather than depending on every caller remembering. - Subject
- A partition’s subject: which principal it was provisioned for. Recorded
only in the store-level
LOCAL_BINDINGS_FILE, never inside a partition directory.
Enums§
- Encryption
Mode - The closed encryption-mode vocabulary (spec §3.2, added per §R.2 /
the security review’s D-1). Set at creation, never changeable in
place — there is no
set_encryption_mode, exactly as there is noset_retention_class; no transition is legal in either direction. - Retention
Class - The closed retention-class vocabulary (spec §3.4). Each class changes
GC behaviour; a class that only labels is a taxonomy and does not
belong here. Deliberately excludes: any retention period
(
retain_days,expires_at), alegal_hold/holdclass, anaudit/complianceclass, and any access-time or access-count field — each refusal is load-bearing and is spelled out in the spec. - Subject
Kind - The subject-kind vocabulary for a local partition binding (spec §3.6,
amended by §R.5). Closed, forever, at exactly three values:
person,household, andservice. Each is a derivation prefix for a principal that gets its own partition — recording a derivation input is not adding a taxonomy, and this enum being closed is what makes that true.
Constants§
- LOCAL_
BINDINGS_ FILE - File name of the store-level, never-replicated local binding record. Lives at the store root, not inside any partition directory — see the module docs and spec §R.4/Q2.
- PARTITION_
RECORD_ FILE - File name of the portable, replicated partition record inside a partition directory.
Functions§
- copy_
partition_ record - Copy
partition.jsonfromsource_store_roottodest_store_rootforpartition_id(spec §3.8). Copies the portable record only — neverLOCAL_BINDINGS_FILE, which is not inside any partition directory and so is out of reach of a per-partition copy by construction.