pub struct CompensationRegistry { /* private fields */ }Expand description
Registry for tracking compensation actions for workflow tasks.
CompensationRegistry maintains a mapping from task IDs to their corresponding compensation actions. During rollback, the registry is consulted to find and execute compensations in reverse order.
Implementations§
Source§impl CompensationRegistry
impl CompensationRegistry
Sourcepub fn register(&mut self, task_id: TaskId, compensation: ToolCompensation)
pub fn register(&mut self, task_id: TaskId, compensation: ToolCompensation)
Sourcepub fn get(&self, task_id: &TaskId) -> Option<&ToolCompensation>
pub fn get(&self, task_id: &TaskId) -> Option<&ToolCompensation>
Sourcepub fn has_compensation(&self, task_id: &TaskId) -> bool
pub fn has_compensation(&self, task_id: &TaskId) -> bool
Sourcepub fn remove(&mut self, task_id: &TaskId) -> Option<ToolCompensation>
pub fn remove(&mut self, task_id: &TaskId) -> Option<ToolCompensation>
Sourcepub fn validate_coverage(&self, task_ids: &[TaskId]) -> CompensationReport
pub fn validate_coverage(&self, task_ids: &[TaskId]) -> CompensationReport
Sourcepub fn register_file_creation(
&mut self,
task_id: TaskId,
file_path: impl Into<String>,
)
pub fn register_file_creation( &mut self, task_id: TaskId, file_path: impl Into<String>, )
Registers a file creation compensation for a task.
Convenience method that automatically creates a file deletion compensation.
§Arguments
task_id- The task ID to register compensation forfile_path- Path to the file that will be deleted during rollback
Sourcepub fn register_process_spawn(&mut self, task_id: TaskId, pid: u32)
pub fn register_process_spawn(&mut self, task_id: TaskId, pid: u32)
Registers a process spawn compensation for a task.
Convenience method that automatically creates a process termination compensation.
§Arguments
task_id- The task ID to register compensation forpid- Process ID to terminate during rollback
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompensationRegistry
impl !RefUnwindSafe for CompensationRegistry
impl Send for CompensationRegistry
impl Sync for CompensationRegistry
impl Unpin for CompensationRegistry
impl UnsafeUnpin for CompensationRegistry
impl !UnwindSafe for CompensationRegistry
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
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>
Converts
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>
Converts
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