pub struct Saga { /* private fields */ }Expand description
Workflow-local deterministic saga compensation helper.
Register each compensation only after its forward step succeeds. Passing
the forward Result to Saga::finish runs compensations sequentially in
reverse registration order after any failure, including cooperative
cancellation. Each compensation is an ordinary durable activity, so replay,
duplicate delivery, and worker restart use existing history semantics.
Implementations§
Source§impl Saga
impl Saga
pub fn add_compensation<T: Serialize>( &mut self, activity_type: impl Into<String>, args: T, ) -> Result<&mut Self>
pub fn add_compensation_with_options<T: Serialize>( &mut self, activity_type: impl Into<String>, options: ActivityOptions, args: T, ) -> Result<&mut Self>
Sourcepub async fn compensate(self, initiating_failure: Error) -> Error
pub async fn compensate(self, initiating_failure: Error) -> Error
Compensate initiating_failure and return the failure that must remain.
Auto Trait Implementations§
impl Freeze for Saga
impl RefUnwindSafe for Saga
impl Send for Saga
impl Sync for Saga
impl Unpin for Saga
impl UnwindSafe for Saga
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
Mutably borrows from an owned value. Read more