Skip to main content

Provenance

Struct Provenance 

Source
pub struct Provenance {
    pub run: RunId,
    pub case: Option<CaseId>,
    pub effect: EffectKey,
    pub dispatch: Option<EffectKey>,
    pub agent: String,
    pub signature: Option<KeySignature>,
}
Expand description

Who is calling, on whose behalf, for which piece of work.

Fields§

§run: RunId§case: Option<CaseId>§effect: EffectKey

Which effect within the run — unique per run and per attempt.

§dispatch: Option<EffectKey>

The logical dispatch, stable across retries of the same call.

effect hashes the attempt number, and it must: without it a retry would collide with the recorded failure of the attempt before it, and replay would read back the failure instead of the retry.

That makes it the wrong thing to hand a callee for duplicate detection, which is the opposite question — “have I already done this work?” — and must answer yes for a retry. A peer given the effect key sees two unrelated messages and may act twice, which is precisely the outcome deduplication exists to prevent.

§agent: String

The agent, as the deployment names it.

§signature: Option<KeySignature>

The signature over payload, if the plane has a signer.

None is honest rather than convenient: a plane with no workload identity cannot attest, and a self-signed block would look attested and prove nothing — the same reasoning that keeps unsigned journal records unsigned rather than self-signed.

Implementations§

Source§

impl Provenance

Source

pub fn new(run: RunId, effect: EffectKey, agent: impl Into<String>) -> Self

Source

pub const fn dispatching(self, dispatch: EffectKey) -> Self

Name the logical dispatch this call belongs to.

See Provenance::dispatch for why it is not the effect key.

Source

pub fn dedupe_key(&self) -> EffectKey

The identity a callee should deduplicate on.

Falls back to the effect key when no dispatch id was supplied, which is wrong across retries and right for everything else — and is what a transport gets if the runtime did not set one.

Source

pub const fn in_case(self, case: Option<CaseId>) -> Self

Source

pub fn payload(&self, target: &str, arguments: &Value) -> Digest

The bytes a signature covers.

Canonical — the same map always hashes the same way — because the callee recomputes this from the wire form and the two must agree byte for byte. Uses this crate’s own canonical writer rather than serde_json’s ordering, for the reason recorded against core::canon: map order is not something to inherit from a dependency’s feature flags.

target and arguments are what bind the signature to this call.

Source

pub fn seal(self, signer: &dyn Signer, target: &str, arguments: &Value) -> Self

Sign this block for one specific call.

Source

pub fn verify( &self, verifier: &dyn Verifier, target: &str, arguments: &Value, ) -> bool

Whether this block was signed for exactly this call.

The callee’s side. Returns false for an unsigned block, an unknown key, and a signature made for a different call alike — they are the same answer to the only question being asked, which is may I act on this.

Source

pub fn to_meta(&self) -> Map<String, Value>

The wire form: a _meta-shaped object.

Source

pub fn from_meta(meta: &Map<String, Value>) -> Option<Self>

Read a block back off the wire.

For a callee, and for the tests that stand in for one. Returns None when the required fields are absent or malformed — a partially parsed block is not something to act on.

Trait Implementations§

Source§

impl Clone for Provenance

Source§

fn clone(&self) -> Self

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 Provenance

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Provenance

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Provenance

Source§

impl PartialEq for Provenance

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Provenance

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Provenance

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> MaybeSend for T
where T: Send,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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