pub struct ProvenanceReceipt {
pub resource: String,
pub mark: Option<GitMark>,
pub anchor: Option<BlockTrailAnchor>,
pub mark_error: Option<String>,
pub anchor_error: Option<String>,
pub skipped: Option<ProvenanceSkip>,
}Expand description
The typed outcome of recording provenance for one write (ADR-2004).
Before this existed, the server composed the write and the mark, logged any
marking failure at warn, and returned 201 Created — so a caller could
not distinguish “stored and provably marked” from “stored, marking silently
failed”. The receipt makes that difference an explicit, inspectable result.
Constructing one never fails: the LDP write has already succeeded by the time provenance runs, and a provenance fault must not change the write’s status. The fault is reported, not raised.
Fields§
§resource: StringPod-relative resource path the receipt describes.
mark: Option<GitMark>The git-mark, when one was committed.
anchor: Option<BlockTrailAnchor>The Bitcoin anchor, when one was produced.
mark_error: Option<String>Why the git-mark failed, when it did. Populating this is what makes a failed mark visible to the caller instead of log-only.
anchor_error: Option<String>Why the anchor failed, when one was attempted and did not succeed.
skipped: Option<ProvenanceSkip>Why marking was not attempted at all.
Implementations§
Source§impl ProvenanceReceipt
impl ProvenanceReceipt
Sourcepub fn skipped(resource: impl Into<String>, why: ProvenanceSkip) -> Self
pub fn skipped(resource: impl Into<String>, why: ProvenanceSkip) -> Self
A receipt for a write that was deliberately not marked.
Sourcepub fn stage(&self) -> ProvenanceStage
pub fn stage(&self) -> ProvenanceStage
The strongest provenance tier this write actually reached.
An anchor counts as AnchorConfirmed
only when it carries a block height; an unconfirmed anchoring
transaction is AnchorSubmitted,
because an unconfirmed transaction can still be replaced.
Sourcepub fn has_failure(&self) -> bool
pub fn has_failure(&self) -> bool
true when a provenance tier was attempted and failed.
A skipped write is not a failure. This is the predicate a caller uses to decide whether to surface a warning to its own client.
Sourcepub fn commit_sha(&self) -> Option<&str>
pub fn commit_sha(&self) -> Option<&str>
The git commit SHA, when one was recorded.