pub enum SagaTerminal<'a> {
Completed,
Compensated {
reason: &'a str,
},
Failed {
reason: &'a str,
},
}Expand description
Outcome a saga’s inner future hands back to emit_terminal.
(codex P1 PR #631) The original PR 1 implementation mapped every
Err to SagaOutcome::Compensated, which is wrong for timeout/
abort paths: run_saga wraps the inner future in
tokio::time::timeout, and a timeout cancels the future before
it can run its compensation block. Recording “compensated” when
nothing was compensated would hide partially-applied state from
PR 2’s compensate_unresolved resume scan — exactly the failure
mode this log exists to catch.
Compensated should only be recorded when compensation actually
completed; everything else (timeout, panic-converted-to-error,
pre-compensation early-return) records Failed, which leaves the
saga visible to PR 2’s resume scan.
Variants§
Completed
All steps applied successfully.
Compensated
Compensation block ran to completion. Caller asserts this only after every compensating dispatch returned without error.
Failed
Saga aborted before/during compensation: timeout, panic, pre-compensation early-return, or any other path where compensation can’t be assumed to have run. Default for the “I don’t know if compensation completed” case.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SagaTerminal<'a>
impl<'a> RefUnwindSafe for SagaTerminal<'a>
impl<'a> Send for SagaTerminal<'a>
impl<'a> Sync for SagaTerminal<'a>
impl<'a> Unpin for SagaTerminal<'a>
impl<'a> UnwindSafe for SagaTerminal<'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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.