pub struct Saga {
pub saga_id: String,
pub steps: Vec<SagaStep>,
pub state: SagaState,
pub current_step: usize,
pub results: HashMap<String, String>,
}Expand description
A saga orchestrating multi-step ceremonies.
Fields§
§saga_id: String§steps: Vec<SagaStep>§state: SagaState§current_step: usize§results: HashMap<String, String>Implementations§
Source§impl Saga
impl Saga
pub fn new(saga_id: &str, step_names: &[&str]) -> Self
Sourcepub fn execute<F>(&mut self, step_fn: F) -> Result<(), String>
pub fn execute<F>(&mut self, step_fn: F) -> Result<(), String>
Execute the saga forward. Returns Ok when all steps complete, Err when a step fails (triggers compensation).
Sourcepub fn compensate<F>(&mut self, compensate_fn: F) -> Result<(), String>
pub fn compensate<F>(&mut self, compensate_fn: F) -> Result<(), String>
Compensate (roll back) completed steps in reverse order.
pub fn progress(&self) -> f64
pub fn completed_steps(&self) -> Vec<&str>
pub fn step_count(&self) -> usize
Auto Trait Implementations§
impl Freeze for Saga
impl RefUnwindSafe for Saga
impl Send for Saga
impl Sync for Saga
impl Unpin for Saga
impl UnsafeUnpin 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