pub struct StateManager { /* private fields */ }Expand description
State manager for pipeline persistence
Implementations§
Source§impl StateManager
impl StateManager
Sourcepub fn new(strategy: PersistenceStrategy, config: CheckpointConfig) -> Self
pub fn new(strategy: PersistenceStrategy, config: CheckpointConfig) -> Self
Create a new state manager
Sourcepub fn save_snapshot(&self, snapshot: StateSnapshot) -> SklResult<()>
pub fn save_snapshot(&self, snapshot: StateSnapshot) -> SklResult<()>
Save a state snapshot
Sourcepub fn load_snapshot(&self, snapshot_id: &str) -> SklResult<StateSnapshot>
pub fn load_snapshot(&self, snapshot_id: &str) -> SklResult<StateSnapshot>
Load a state snapshot
Sourcepub fn create_checkpoint(
&self,
pipeline_id: &str,
state_data: StateData,
) -> SklResult<String>
pub fn create_checkpoint( &self, pipeline_id: &str, state_data: StateData, ) -> SklResult<String>
Create a checkpoint of current pipeline state
Sourcepub fn resume_from_checkpoint(&self, snapshot_id: &str) -> SklResult<StateData>
pub fn resume_from_checkpoint(&self, snapshot_id: &str) -> SklResult<StateData>
Resume from a checkpoint
Sourcepub fn list_snapshots(&self) -> Vec<String>
pub fn list_snapshots(&self) -> Vec<String>
List available snapshots
Sourcepub fn get_version_history(&self) -> Vec<String>
pub fn get_version_history(&self) -> Vec<String>
Get version history
Sourcepub fn rollback(&self, target_snapshot_id: &str) -> SklResult<StateData>
pub fn rollback(&self, target_snapshot_id: &str) -> SklResult<StateData>
Rollback to a previous version
Sourcepub fn delete_snapshot(&self, snapshot_id: &str) -> SklResult<()>
pub fn delete_snapshot(&self, snapshot_id: &str) -> SklResult<()>
Delete a snapshot
Sourcepub fn start_auto_checkpoint(
&self,
pipeline_id: String,
state_provider: Arc<dyn Fn() -> SklResult<StateData> + Send + Sync>,
) -> SklResult<()>
pub fn start_auto_checkpoint( &self, pipeline_id: String, state_provider: Arc<dyn Fn() -> SklResult<StateData> + Send + Sync>, ) -> SklResult<()>
Start automatic checkpointing
Sourcepub fn stop_auto_checkpoint(&self, pipeline_id: &str) -> SklResult<()>
pub fn stop_auto_checkpoint(&self, pipeline_id: &str) -> SklResult<()>
Stop automatic checkpointing
Sourcepub fn add_listener(&self, listener: Box<dyn Fn(&StateSnapshot) + Send + Sync>)
pub fn add_listener(&self, listener: Box<dyn Fn(&StateSnapshot) + Send + Sync>)
Add a state change listener
Auto Trait Implementations§
impl Freeze for StateManager
impl RefUnwindSafe for StateManager
impl Send for StateManager
impl Sync for StateManager
impl Unpin for StateManager
impl UnwindSafe for StateManager
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> 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