pub struct StateVisibilityBlob {
pub format_version: u8,
pub records: Vec<StateVisibility>,
}Expand description
On-disk blob containing all visibility records for a single state. One
file per state, encoded with rmp-serde — mirrors the
RedactionsBlob sidecar pattern.
Fields§
§format_version: u8§records: Vec<StateVisibility>Implementations§
Source§impl StateVisibilityBlob
impl StateVisibilityBlob
pub const FORMAT_VERSION: u8 = 1
pub fn new(records: Vec<StateVisibility>) -> Self
pub fn encode(&self) -> Result<Vec<u8>, StateVisibilityError>
pub fn decode(bytes: &[u8]) -> Result<Self, StateVisibilityError>
pub fn validate(&self) -> Result<(), StateVisibilityError>
Source§impl StateVisibilityBlob
impl StateVisibilityBlob
pub fn empty() -> Self
pub fn push(&mut self, record: StateVisibility)
Sourcepub fn has_record(&self) -> bool
pub fn has_record(&self) -> bool
true iff this state carries any visibility record — i.e. it is not
public-by-absence. Used by the sidecar’s has_visibility_for_state.
Sourcepub fn latest(&self) -> Result<Option<&StateVisibility>, StateVisibilityError>
pub fn latest(&self) -> Result<Option<&StateVisibility>, StateVisibilityError>
The effective record: the head of the supersede DAG — the record in
this blob that no other record supersedes — resolved purely from the
records’ content-intrinsic supersedes
pointers, never from wall-clock declared_at.
Each locally-committed declaration links onto the prior head it read
under the repo write lock — its supersedes points at that head’s
content hash (heddle#317 / PR #529 P1) — so for serialized local writes
the chain is linear and the head is the last-committed record,
independent of clock skew or whatever order the timestamps happen to
carry. declared_at is an audit/display field only. This also fixes a
latent cross-host bug: wall-clock cannot order records replicated across
hosts whose clocks disagree, but the content-hash chain can.
Fork tie-break (concurrent / cross-host). Two records can supersede
the same prior with neither superseding the other — a genuine
concurrent fork, e.g. two hosts that diverged. Both are heads. To make
every replica resolve the SAME effective record without consulting
wall-clock, the tie is broken by the lexicographically greatest record
content hash — a content-intrinsic, host-independent key. Cycles are
cryptographically unconstructable (a record’s hash covers its
supersedes pointer, so no record can supersede one minted after it), so
a non-empty blob always has at least one head.
Trait Implementations§
Source§impl Clone for StateVisibilityBlob
impl Clone for StateVisibilityBlob
Source§fn clone(&self) -> StateVisibilityBlob
fn clone(&self) -> StateVisibilityBlob
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StateVisibilityBlob
impl Debug for StateVisibilityBlob
Source§impl<'de> Deserialize<'de> for StateVisibilityBlob
impl<'de> Deserialize<'de> for StateVisibilityBlob
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for StateVisibilityBlob
Source§impl PartialEq for StateVisibilityBlob
impl PartialEq for StateVisibilityBlob
Source§fn eq(&self, other: &StateVisibilityBlob) -> bool
fn eq(&self, other: &StateVisibilityBlob) -> bool
self and other values to be equal, and is used by ==.