pub struct StateVisibility {
pub state: ChangeId,
pub tier: VisibilityTier,
pub embargo_until: Option<DateTime<Utc>>,
pub declarer: Principal,
pub declared_at: DateTime<Utc>,
pub signature: Option<StateSignature>,
pub supersedes: Option<ContentHash>,
}Expand description
A visibility-tier declaration on a single state.
Fields§
§state: ChangeIdThe state (commit) this tier applies to.
tier: VisibilityTierThe audience tier the state’s content is served at.
embargo_until: Option<DateTime<Utc>>When set, the host materializes a superseding public record at this instant (auto-promote). Advisory schedule only — the effective tier is always read from the persisted records, never recomputed from wall-clock at read time.
declarer: PrincipalWho declared the tier.
declared_at: DateTime<Utc>When the tier was declared. RFC3339 at the wire boundary;
DateTime<Utc> internally.
signature: Option<StateSignature>Optional cryptographic signature over the canonical signing payload
(see canonical_signing_payload).
None for unsigned declarations.
supersedes: Option<ContentHash>The record this one supersedes, if any — promotion appends a superseding record rather than mutating a prior one. Identified by the prior record’s content hash.
Implementations§
Source§impl StateVisibility
impl StateVisibility
Sourcepub fn canonical_signing_payload(&self) -> Vec<u8> ⓘ
pub fn canonical_signing_payload(&self) -> Vec<u8> ⓘ
Build the canonical bytes a signer covers. The signature field is
intentionally excluded (a signature can’t sign itself).
Sourcepub fn validate(&self) -> Result<(), StateVisibilityError>
pub fn validate(&self) -> Result<(), StateVisibilityError>
Per-item validation hook required by [versioned_msgpack_blob!].
A TeamScoped/Restricted tier must carry a non-empty label —
an empty label is meaningless and would silently widen the
audience to “any team / any restricted scope”.
Sourcepub fn content_hash(&self) -> Result<ContentHash, StateVisibilityError>
pub fn content_hash(&self) -> Result<ContentHash, StateVisibilityError>
Content-addressed id of this record: blake3 over the canonical
rmp-encoded bytes of a one-element StateVisibilityBlob. This is the
id a superseding record stores in its supersedes
pointer, and the key StateVisibilityBlob::latest resolves the
supersede chain by — so the write path (which sets supersedes from the
under-lock head) and the read path (which walks the chain) agree by
construction. The id covers the single record’s bytes embedded in the
versioned envelope, so it stays stable across schema additions that only
extend the container.
Trait Implementations§
Source§impl Clone for StateVisibility
impl Clone for StateVisibility
Source§fn clone(&self) -> StateVisibility
fn clone(&self) -> StateVisibility
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 StateVisibility
impl Debug for StateVisibility
Source§impl<'de> Deserialize<'de> for StateVisibility
impl<'de> Deserialize<'de> for StateVisibility
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 StateVisibility
Source§impl PartialEq for StateVisibility
impl PartialEq for StateVisibility
Source§fn eq(&self, other: &StateVisibility) -> bool
fn eq(&self, other: &StateVisibility) -> bool
self and other values to be equal, and is used by ==.