pub struct RefSnapshot {
pub format_version: u16,
pub refs: BTreeMap<String, ContentHash>,
pub at_seq: u64,
pub prev_snapshot: Option<ContentHash>,
}Expand description
A signed attestation that the complete ref-state at log position
RefSnapshot::at_seq was exactly RefSnapshot::refs (D25).
Carried inside OpKind::RecordRefSnapshot, and written detached —
byte-identical — beside mirror bundles so a bundle is checkable
against something other than itself.
The chain pointer lives inside this struct rather than being
inherited from OpEntry.parent because seq/parent are assigned
after signing: a snapshot copied out of the log would otherwise carry
no chain of its own, and an old one could be served forever. Same
discipline as the CAS prev inside a payload.
Ref names are map keys, and a git ref name may legally carry " and
any non-ASCII byte (git forbids control bytes, space, ~^:?*[\, but
not quotes or high bytes) — and an API-submitted name is not bound by
git’s grammar at all. Canonical serialization of hostile keys is
therefore pinned by this struct’s golden vector and property tests,
not assumed.
Fields§
§format_version: u16Wire-format version; see FORMAT_VERSION.
refs: BTreeMap<String, ContentHash>The complete ref map at at_seq, in the view’s namespaced form
(<repo>:<refname>). Every ref the view holds — a selection
would let an equivocating node attest only the refs it is honest
about.
at_seq: u64The fold position the state was read at: the number of ops applied before this one. Admission requires it to equal the view’s position, so it is also the sequence this op itself occupies in the log.
prev_snapshot: Option<ContentHash>Content address (RefSnapshot::id) of the previous snapshot on
this log; None only for a log’s first snapshot. Additive per
invariant 1.
Implementations§
Source§impl RefSnapshot
impl RefSnapshot
Sourcepub fn canonical_bytes(&self) -> Vec<u8> ⓘ
pub fn canonical_bytes(&self) -> Vec<u8> ⓘ
The canonical bytes: what is hashed, what the author signs over (inside the op payload), and what the detached file contains.
Sourcepub fn id(&self) -> ContentHash
pub fn id(&self) -> ContentHash
Content address of the canonical bytes — the identity the next
snapshot’s prev_snapshot names.
Trait Implementations§
Source§impl Clone for RefSnapshot
impl Clone for RefSnapshot
Source§fn clone(&self) -> RefSnapshot
fn clone(&self) -> RefSnapshot
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 RefSnapshot
impl Debug for RefSnapshot
Source§impl<'de> Deserialize<'de> for RefSnapshot
impl<'de> Deserialize<'de> for RefSnapshot
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>,
Source§impl PartialEq for RefSnapshot
impl PartialEq for RefSnapshot
Source§fn eq(&self, other: &RefSnapshot) -> bool
fn eq(&self, other: &RefSnapshot) -> bool
self and other values to be equal, and is used by ==.