pub struct StorageIntegration;Expand description
Storage integration for workflow state persistence
Implementations§
Source§impl StorageIntegration
impl StorageIntegration
Sourcepub fn persist_state(
state: &WorkflowState,
storage_path: &Path,
) -> WorkflowResult<()>
pub fn persist_state( state: &WorkflowState, storage_path: &Path, ) -> WorkflowResult<()>
Persist workflow state using storage manager
This function handles storage errors gracefully by:
- Creating necessary directories
- Serializing state to JSON format
- Handling IO errors with context
Sourcepub fn load_state(storage_path: &Path) -> WorkflowResult<WorkflowState>
pub fn load_state(storage_path: &Path) -> WorkflowResult<WorkflowState>
Load workflow state from storage
This function handles storage errors gracefully by:
- Checking if file exists
- Reading and deserializing JSON
- Validating state integrity
Sourcepub fn load_state_validated(
storage_path: &Path,
) -> WorkflowResult<WorkflowState>
pub fn load_state_validated( storage_path: &Path, ) -> WorkflowResult<WorkflowState>
Load workflow state with validation
Validates state integrity after loading to ensure:
- Workflow ID is not empty
- All completed steps have results
- Current step (if any) has a result
Sourcepub fn delete_state(storage_path: &Path) -> WorkflowResult<()>
pub fn delete_state(storage_path: &Path) -> WorkflowResult<()>
Delete workflow state from storage
Handles deletion errors gracefully
Sourcepub fn state_exists(storage_path: &Path) -> bool
pub fn state_exists(storage_path: &Path) -> bool
Check if workflow state exists in storage
Sourcepub fn get_workflow_state_path(base_path: &Path, workflow_id: &str) -> PathBuf
pub fn get_workflow_state_path(base_path: &Path, workflow_id: &str) -> PathBuf
Get the storage path for a workflow
Constructs a path like: {base_path}/workflows/{workflow_id}/state.json
Sourcepub fn get_workflow_storage_dir(base_path: &Path, workflow_id: &str) -> PathBuf
pub fn get_workflow_storage_dir(base_path: &Path, workflow_id: &str) -> PathBuf
Get the storage directory for a workflow
Constructs a path like: {base_path}/workflows/{workflow_id}/
Auto Trait Implementations§
impl Freeze for StorageIntegration
impl RefUnwindSafe for StorageIntegration
impl Send for StorageIntegration
impl Sync for StorageIntegration
impl Unpin for StorageIntegration
impl UnwindSafe for StorageIntegration
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