pub enum Compensation {
Undeclared,
Compensatable,
Pivot,
Unnecessary,
}Expand description
A step’s place in the saga, and what undoing it means.
A plan that touches real systems cannot be a transaction — there is nothing to roll back across a payment provider and a warehouse. The saga answer is to undo forward: when a later step fails, earlier steps are compensated in reverse order. Compensation is a recovery design, not a time machine, and what a step declares here is what the runtime is allowed to assume about it.
Variants§
Undeclared
Nothing declared.
Resolved from evidence rather than assumed. A step that performed no mutating effect has nothing to undo, and the journal proves it — that step passes. A step that did mutate and declared nothing is escalated, because silently leaving a charge in place while unwinding everything around it is the failure this whole mechanism exists to prevent.
The default, so forgetting to declare is loud rather than convenient.
Compensatable
Skill::compensate undoes this step.
Pivot
The saga’s point of no return.
Once a pivot commits, the business is committed: nothing before it is undone, because undoing it would reverse a decision the outside world has already acted on. A failure after the pivot escalates rather than unwinding.
Unnecessary
Nothing to undo, and the author says so.
Distinct from Undeclared: this is a claim someone
made, and it appears in the journal as one.
Trait Implementations§
Source§impl Clone for Compensation
impl Clone for Compensation
impl Copy for Compensation
Source§impl Debug for Compensation
impl Debug for Compensation
Source§impl Default for Compensation
impl Default for Compensation
Source§impl<'de> Deserialize<'de> for Compensation
impl<'de> Deserialize<'de> for Compensation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Compensation
Source§impl PartialEq for Compensation
impl PartialEq for Compensation
Source§impl Serialize for Compensation
impl Serialize for Compensation
impl StructuralPartialEq for Compensation
Auto Trait Implementations§
impl Freeze for Compensation
impl RefUnwindSafe for Compensation
impl Send for Compensation
impl Sync for Compensation
impl Unpin for Compensation
impl UnsafeUnpin for Compensation
impl UnwindSafe for Compensation
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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