pub struct ProvenanceLog {
pub marker: Arc<dyn GitMarker>,
pub anchorer: Option<Arc<dyn BlockAnchorer>>,
}Expand description
The composition point for the two provenance tiers (master-plan §2.2/§2.3, ADR-059 D1).
A ProvenanceLog always holds the cheap-tier GitMarker and optionally
the expensive-tier BlockAnchorer. record
implements the cheap-always, expensive-opt-in rule:
- Always
marker.mark_write()→GitMark(every write becomes a commit; we capture the SHA). - Conditionally
anchorer.anchor()when theAnchorPolicysays this write anchors inline AND an anchorer is present. The anchor’sstate_hashis set to the git commit SHA — so the Bitcoin UTXO commits to the git history, binding the two tiers into one chain (§2.3).
The returned ProvenanceMark carries the git-mark always and the anchor
when one was produced. Persisting the PROV-O sidecar and emitting the
Updates-via notification (step 3) is the server’s job — kept out of this
pure surface so it compiles for wasm.
§wasm32 safety
Arc<dyn GitMarker> / Arc<dyn BlockAnchorer> are ?Send trait objects;
the type holds no runtime. On wasm the pod constructs it with a no-op marker
and anchorer: None, so record is git-mark-only and never reaches any
Bitcoin I/O.
Fields§
§marker: Arc<dyn GitMarker>Cheap tier — always invoked. The native server injects
solid-pod-rs-git’s ShellGitMarker; wasm injects a no-op.
anchorer: Option<Arc<dyn BlockAnchorer>>Expensive tier — optional. None in pods that do not pay for Bitcoin
anchoring (and always None on wasm).
Implementations§
Source§impl ProvenanceLog
impl ProvenanceLog
Sourcepub fn new(marker: Arc<dyn GitMarker>) -> Self
pub fn new(marker: Arc<dyn GitMarker>) -> Self
Construct a git-mark-only log (no Bitcoin tier). The common case for ordinary pods and the only shape available on wasm.
Sourcepub fn with_anchorer(
marker: Arc<dyn GitMarker>,
anchorer: Arc<dyn BlockAnchorer>,
) -> Self
pub fn with_anchorer( marker: Arc<dyn GitMarker>, anchorer: Arc<dyn BlockAnchorer>, ) -> Self
Construct a log with both tiers wired.
Sourcepub async fn record(
&self,
rec: WriteRecord<'_>,
) -> Result<ProvenanceMark, ProvenanceError>
pub async fn record( &self, rec: WriteRecord<'_>, ) -> Result<ProvenanceMark, ProvenanceError>
Record a pod resource write across both tiers (the composition rule).
The write is described by a WriteRecord. Always commits (cheap tier).
Then, iff policy.anchors_inline(high_value) — both carried by the
WriteRecord — AND an anchorer is present, anchors the git commit
SHA under the record’s ticker/network, attaching the
BlockTrailAnchor to the returned mark. The anchor’s state_hash is
the commit SHA, binding git ↔ Bitcoin (master-plan §2.3).
For AnchorPolicy::Epoch this method never anchors inline — the caller
feeds the returned git.commit_sha into an EpochAccumulator and
anchors the batch root on epoch close.
Errors from the cheap tier propagate (the git-mark is the contract). Errors from the expensive tier are returned too, so the caller can decide its own best-effort policy — the server hook logs+swallows them (a failed anchor must never fail the LDP write), exactly as it does for the git-mark.
Trait Implementations§
Source§impl Clone for ProvenanceLog
impl Clone for ProvenanceLog
Source§fn clone(&self) -> ProvenanceLog
fn clone(&self) -> ProvenanceLog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more