pub struct ConsumeChecks<'a> {
pub freshness: FreshnessPolicy,
pub replay: ReplayPolicy<'a>,
}Expand description
The two stateful consumer checks SPEC.md §7.2 requires and that no runtime
in this repo implemented before 0.11.18: the freshness bound over
issuedAt / expiresAt, and the duplicate-execution record of item 11.
They travel together because the spec ties them together. §7.2 (Bounding the record) makes the acceptance window and the replay record’s retention the same bound: a consumer “MUST NOT accept for execution a document older than the window over which it retains records”. Passing them as one argument is what stops a deployment configuring a five-minute record and an unbounded acceptance window, which reads as a working replay defence and is not one.
Like PayloadPolicy, this is a required argument rather than a
defaulted one. Whether the task a consumer implements is consequential
(§2) is a decision only that consumer can make, and the failure mode of
getting it wrong silently — an ACL grant applied twice by a mediator retry
— is not one to discover after the fact.
Fields§
§freshness: FreshnessPolicyBounds the document in time (SPEC §4.2, §7.2 item 4).
replay: ReplayPolicy<'a>Applies (or knowingly disapplies) the duplicate-execution rule of SPEC §7.2 item 11.
Implementations§
Source§impl<'a> ConsumeChecks<'a>
impl<'a> ConsumeChecks<'a>
Sourcepub fn consequential(guard: &'a dyn ReplayGuard) -> ConsumeChecks<'a>
pub fn consequential(guard: &'a dyn ReplayGuard) -> ConsumeChecks<'a>
The posture for a consequential Trust Task (§2): item 11 enforced
against guard, and the bounded acceptance window
(FreshnessPolicy::consequential) that makes the record droppable.
This is the right constructor for any task whose execution grants access, moves value, discloses a secret, or otherwise cannot be undone by ignoring the next document.
Sourcepub fn not_consequential() -> ConsumeChecks<'a>
pub fn not_consequential() -> ConsumeChecks<'a>
The posture for a task that is not consequential, or for one whose Trust Task specification “explicitly declares repeated execution safe and intended” — the narrow disapplication item 11 permits.
Keeps no record. Still applies FreshnessPolicy::default, because
a future-dated document and one with an empty validity interval are
malformed whatever the task does.
Sourcepub fn with_freshness(self, freshness: FreshnessPolicy) -> ConsumeChecks<'a>
pub fn with_freshness(self, freshness: FreshnessPolicy) -> ConsumeChecks<'a>
Builder: override the freshness policy.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ConsumeChecks<'a>
impl<'a> !UnwindSafe for ConsumeChecks<'a>
impl<'a> Freeze for ConsumeChecks<'a>
impl<'a> Send for ConsumeChecks<'a>
impl<'a> Sync for ConsumeChecks<'a>
impl<'a> Unpin for ConsumeChecks<'a>
impl<'a> UnsafeUnpin for ConsumeChecks<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ResourceProvider<()> for T
impl<T> ResourceProvider<()> for T
Source§fn get_resource(&self) -> &()
fn get_resource(&self) -> &()
T.