pub struct EntryVisibility {
pub format_version: u8,
pub change_id: ChangeId,
pub tree_root: ContentHash,
pub entries: Vec<EntryVisibilityEntry>,
}Expand description
The per-state entry-visibility sidecar: the set of per-entry tier overrides
covering the trees reachable from one state, keyed by that state’s
ChangeId.
Fields§
§format_version: u8Format version; Self::decode rejects anything but the current one.
change_id: ChangeIdThe state (by rewrite-stable change id) these overrides apply to.
tree_root: ContentHashThe state’s root tree id — the anchor the entry records hang beneath.
entries: Vec<EntryVisibilityEntry>The per-entry overrides. Order is normalized (by (tree_id, leaf_hash))
so the encoded bytes are canonical for a given override set.
Implementations§
Source§impl EntryVisibility
impl EntryVisibility
Sourcepub fn new(
change_id: ChangeId,
tree_root: ContentHash,
entries: Vec<EntryVisibilityEntry>,
) -> Result<EntryVisibility, EntryVisibilityError>
pub fn new( change_id: ChangeId, tree_root: ContentHash, entries: Vec<EntryVisibilityEntry>, ) -> Result<EntryVisibility, EntryVisibilityError>
Build a sidecar from its overrides, normalizing entry order so equal override sets encode to identical bytes (and hash identically).
Fails loud on a conflicting duplicate: two overrides on the same
(tree_id, leaf_hash) with different tiers. Leg 3 keys a serve-time
map by leaf hash, so a duplicate leaf would be silent first/last-wins
ambiguity. An exact duplicate (same leaf, same tier) is harmless and is
de-duplicated.
Sourcepub fn has_records(&self) -> bool
pub fn has_records(&self) -> bool
true iff this sidecar carries at least one override. An empty sidecar
is never persisted (absence ≡ “every entry at the state baseline”).
Sourcepub fn encode(&self) -> Result<Vec<u8>, EntryVisibilityError>
pub fn encode(&self) -> Result<Vec<u8>, EntryVisibilityError>
Encode to canonical msgpack bytes.
Sourcepub fn decode(bytes: &[u8]) -> Result<EntryVisibility, EntryVisibilityError>
pub fn decode(bytes: &[u8]) -> Result<EntryVisibility, EntryVisibilityError>
Decode msgpack bytes, rejecting an unsupported format version.
Sourcepub fn content_hash(&self) -> Result<ContentHash, EntryVisibilityError>
pub fn content_hash(&self) -> Result<ContentHash, EntryVisibilityError>
Content-addressed id of this sidecar — blake3 over its canonical
encoded bytes. Named in the oplog record so undo/redo can correlate.
Trait Implementations§
Source§impl Clone for EntryVisibility
impl Clone for EntryVisibility
Source§fn clone(&self) -> EntryVisibility
fn clone(&self) -> EntryVisibility
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more