pub enum Verdict {
Valid,
Stale {
replacement_digest: Option<String>,
},
Gone,
Unknown,
}Expand description
A provider’s answer for one frame (docs/context-reuse.md §4).
Serializes as an internally-tagged object keyed on status, so a verdict is
self-describing on the wire and gains variants without breaking parsers:
{"status": "valid"}, {"status": "stale", "replacement_digest": "sha256:…"},
{"status": "gone"}, {"status": "unknown"}.
Variants§
Valid
The frame’s content is unchanged: the digest the host presented matches the provider’s current digest for that frame. The host MAY keep reusing the body it already holds.
Stale
The frame still exists but its content changed — the presented digest no longer matches. The host MUST NOT keep serving the body it holds.
replacement_digest is the provider’s current digest for the frame,
offered so a host can tell “changed again since I last looked” from
“changed to something I already fetched” without a round trip. It is
optional: a provider that knows the content differs but not what it is
now still answers stale honestly. It is a digest, never a body —
the host re-queries if it wants the new content.
Gone
The frame no longer exists — the source was deleted, or the provider no longer serves it. The host MUST drop it, and re-querying this identity is pointless.
Unknown
The provider cannot say. It may never have served this frame, may have lost the history needed to compare digests (a rebuilt index), or may not recognize the identity. The host MUST NOT treat this as validity — an unverifiable frame is re-queried, never reused on a shrug.
Implementations§
Source§impl Verdict
impl Verdict
Sourcepub fn permits_reuse(&self) -> bool
pub fn permits_reuse(&self) -> bool
Whether a host may keep reusing the frame body it already holds. Only
Valid — reuse requires a positive answer, never the
absence of a negative one (docs/context-reuse.md §4, requirement V2).