Skip to main content

ProvenanceLog

Struct ProvenanceLog 

Source
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:

  1. Always marker.mark_write()GitMark (every write becomes a commit; we capture the SHA).
  2. Conditionally anchorer.anchor() when the AnchorPolicy says this write anchors inline AND an anchorer is present. The anchor’s state_hash is 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

Source

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.

Source

pub fn with_anchorer( marker: Arc<dyn GitMarker>, anchorer: Arc<dyn BlockAnchorer>, ) -> Self

Construct a log with both tiers wired.

Source

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

Source§

fn clone(&self) -> ProvenanceLog

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProvenanceLog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more