RollbackManager

Struct RollbackManager 

Source
pub struct RollbackManager { /* private fields */ }
Expand description

Manages execution snapshots and rollback operations

Implementations§

Source§

impl RollbackManager

Source

pub fn new(max_snapshots: usize) -> Self

Create a new rollback manager

§Arguments
  • max_snapshots - Maximum number of snapshots to keep
Source

pub fn with_auto_snapshot(self, interval: usize) -> Self

Enable automatic snapshots every N nodes

Source

pub fn push_snapshot(&mut self, snapshot: ExecutionSnapshot)

Push a new snapshot

If max_snapshots is reached, the oldest snapshot is removed.

Source

pub fn create_snapshot(&mut self, ctx: &ExecutionContext) -> Uuid

Create and push a snapshot from an execution context

Source

pub fn create_labeled_snapshot( &mut self, ctx: &ExecutionContext, label: impl Into<String>, ) -> Uuid

Create a labeled snapshot

Source

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.

Source

pub fn rollback(&mut self, ctx: &mut ExecutionContext) -> RollbackResult

Rollback to the most recent snapshot

Source

pub fn rollback_to( &mut self, ctx: &mut ExecutionContext, snapshot_id: Uuid, ) -> RollbackResult

Rollback to a specific snapshot by ID

Source

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.

Source

pub fn latest_snapshot(&self) -> Option<&ExecutionSnapshot>

Get the most recent snapshot

Source

pub fn get_snapshot(&self, id: Uuid) -> Option<&ExecutionSnapshot>

Get a snapshot by ID

Source

pub fn list_snapshots(&self) -> Vec<&ExecutionSnapshot>

List all snapshots (newest first)

Source

pub fn snapshot_count(&self) -> usize

Get the number of available snapshots

Source

pub fn clear(&mut self)

Clear all snapshots

Source

pub fn prune_before(&mut self, timestamp: DateTime<Utc>) -> usize

Remove snapshots older than a timestamp

Source

pub fn summary(&self) -> RollbackSummary

Get summary of snapshot history

Trait Implementations§

Source§

impl Clone for RollbackManager

Source§

fn clone(&self) -> RollbackManager

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RollbackManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RollbackManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V