pub struct RollbackManager { /* private fields */ }Expand description
Manages execution snapshots and rollback operations
Implementations§
Source§impl RollbackManager
impl RollbackManager
Sourcepub fn with_auto_snapshot(self, interval: usize) -> Self
pub fn with_auto_snapshot(self, interval: usize) -> Self
Enable automatic snapshots every N nodes
Sourcepub fn push_snapshot(&mut self, snapshot: ExecutionSnapshot)
pub fn push_snapshot(&mut self, snapshot: ExecutionSnapshot)
Push a new snapshot
If max_snapshots is reached, the oldest snapshot is removed.
Sourcepub fn create_snapshot(&mut self, ctx: &ExecutionContext) -> Uuid
pub fn create_snapshot(&mut self, ctx: &ExecutionContext) -> Uuid
Create and push a snapshot from an execution context
Sourcepub fn create_labeled_snapshot(
&mut self,
ctx: &ExecutionContext,
label: impl Into<String>,
) -> Uuid
pub fn create_labeled_snapshot( &mut self, ctx: &ExecutionContext, label: impl Into<String>, ) -> Uuid
Create a labeled snapshot
Sourcepub fn on_node_execute(
&mut self,
ctx: &ExecutionContext,
node_id: NodeId,
) -> Option<Uuid>
pub fn on_node_execute( &mut self, ctx: &ExecutionContext, node_id: NodeId, ) -> Option<Uuid>
Called when a node is about to execute
Creates automatic snapshots if enabled.
Sourcepub fn rollback(&mut self, ctx: &mut ExecutionContext) -> RollbackResult
pub fn rollback(&mut self, ctx: &mut ExecutionContext) -> RollbackResult
Rollback to the most recent snapshot
Sourcepub fn rollback_to(
&mut self,
ctx: &mut ExecutionContext,
snapshot_id: Uuid,
) -> RollbackResult
pub fn rollback_to( &mut self, ctx: &mut ExecutionContext, snapshot_id: Uuid, ) -> RollbackResult
Rollback to a specific snapshot by ID
Sourcepub fn rollback_n(
&mut self,
ctx: &mut ExecutionContext,
steps: usize,
) -> RollbackResult
pub fn rollback_n( &mut self, ctx: &mut ExecutionContext, steps: usize, ) -> RollbackResult
Rollback N steps in history
rollback_n(1)returns to the most recent snapshot (index 0)rollback_n(2)returns to 2 snapshots ago (index 1)rollback_n(3)returns to 3 snapshots ago (index 2)
Note: “Steps” refers to how many states back in history to go, where each snapshot is one state.
Sourcepub fn latest_snapshot(&self) -> Option<&ExecutionSnapshot>
pub fn latest_snapshot(&self) -> Option<&ExecutionSnapshot>
Get the most recent snapshot
Sourcepub fn get_snapshot(&self, id: Uuid) -> Option<&ExecutionSnapshot>
pub fn get_snapshot(&self, id: Uuid) -> Option<&ExecutionSnapshot>
Get a snapshot by ID
Sourcepub fn list_snapshots(&self) -> Vec<&ExecutionSnapshot>
pub fn list_snapshots(&self) -> Vec<&ExecutionSnapshot>
List all snapshots (newest first)
Sourcepub fn snapshot_count(&self) -> usize
pub fn snapshot_count(&self) -> usize
Get the number of available snapshots
Sourcepub fn prune_before(&mut self, timestamp: DateTime<Utc>) -> usize
pub fn prune_before(&mut self, timestamp: DateTime<Utc>) -> usize
Remove snapshots older than a timestamp
Sourcepub fn summary(&self) -> RollbackSummary
pub fn summary(&self) -> RollbackSummary
Get summary of snapshot history
Trait Implementations§
Source§impl Clone for RollbackManager
impl Clone for RollbackManager
Source§fn clone(&self) -> RollbackManager
fn clone(&self) -> RollbackManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RollbackManager
impl Debug for RollbackManager
Auto Trait Implementations§
impl Freeze for RollbackManager
impl RefUnwindSafe for RollbackManager
impl Send for RollbackManager
impl Sync for RollbackManager
impl Unpin for RollbackManager
impl UnwindSafe for RollbackManager
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