pub struct Delivery { /* private fields */ }Expand description
One event and, at a strong decision point, its exactly-once decision guard.
Most deliveries are ordinary transport: read the event
and move on. Three kinds are not — they are a rendezvous the Run is blocked
on, and it does not proceed until this delivery is
accepted or rejected. Dropping
one undecided rejects it.
You never have to know which three. decision_point
says so per delivery, which makes the whole acceptance protocol one line:
if delivery.decision_point().is_some() {
delivery.accept()?;
}A consumer that means to refuse the governed work — an approval policy that
says no, a host shutting down — calls reject instead,
and the tool call it guards never runs.
Implementations§
Source§impl Delivery
impl Delivery
Sourcepub const fn decision_point(&self) -> Option<DecisionPoint>
pub const fn decision_point(&self) -> Option<DecisionPoint>
Returns the strong decision point, or None for ordinary transport delivery.
Sourcepub fn accept(&self) -> Result<(), DecisionError>
pub fn accept(&self) -> Result<(), DecisionError>
Accepts this strong boundary exactly once.
§Errors
DecisionError::NotRequiredif this is ordinary transport delivery rather than one of the three strong seams. Checkdecision_pointto tell them apart; nothing is owed for an ordinary delivery and nothing happens if it is dropped undecided.DecisionError::AlreadyDecidedif this delivery has already been decided, or if cancellation resolved it first. A cancelled Run’s deliveries report this even on a first call, because acceptance would authorize work the Run is already unwinding out of — so a consumer cannot treat this variant as “somebody else said yes”.
Either way the governed work does not proceed on this call’s authority, and the decision that did win is not displaced.
Sourcepub fn reject(&self) -> Result<(), DecisionError>
pub fn reject(&self) -> Result<(), DecisionError>
Rejects this strong boundary exactly once.
§Errors
DecisionError::NotRequired if this is ordinary transport delivery, or
DecisionError::AlreadyDecided if a decision or a cancellation already
won — the same two conditions accept reports, for the
same reasons.
Neither is a reason to retry: a delivery that fails to reject was already resolved to something that also stops the governed work, since dropping an undecided delivery rejects it and cancellation outranks both.
Trait Implementations§
Source§impl Debug for Delivery
impl Debug for Delivery
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
Shows the event, the decision point, and whether a decision is owed.
The decision guard is reported by presence rather than by state: reading its state would mean loading the very atomic whose exactly-once transition the guard exists to serialise, and a formatter has no business participating in that handshake.