pub struct StateManager { /* private fields */ }Expand description
Manages persistent state for bulk operations
Implementations§
Source§impl StateManager
impl StateManager
Sourcepub fn new() -> Result<Self, AdminError>
pub fn new() -> Result<Self, AdminError>
Create a new state manager using the default state directory
Sourcepub fn with_dir(state_dir: PathBuf) -> Result<Self, AdminError>
pub fn with_dir(state_dir: PathBuf) -> Result<Self, AdminError>
Create a state manager with a custom directory (for testing)
Sourcepub async fn create_operation(
&self,
operation_type: OperationType,
parameters: Value,
project_ids: Vec<String>,
) -> Result<Uuid, AdminError>
pub async fn create_operation( &self, operation_type: OperationType, parameters: Value, project_ids: Vec<String>, ) -> Result<Uuid, AdminError>
Sourcepub async fn load_operation(
&self,
operation_id: Uuid,
) -> Result<OperationState, AdminError>
pub async fn load_operation( &self, operation_id: Uuid, ) -> Result<OperationState, AdminError>
Load an existing operation state
Sourcepub async fn update_state(
&self,
operation_id: Uuid,
update: StateUpdate,
) -> Result<(), AdminError>
pub async fn update_state( &self, operation_id: Uuid, update: StateUpdate, ) -> Result<(), AdminError>
Update operation state
Sourcepub async fn complete_operation(
&self,
operation_id: Uuid,
status: OperationStatus,
) -> Result<(), AdminError>
pub async fn complete_operation( &self, operation_id: Uuid, status: OperationStatus, ) -> Result<(), AdminError>
Mark operation as complete with final result
Sourcepub async fn list_operations(
&self,
status_filter: Option<OperationStatus>,
) -> Result<Vec<OperationSummary>, AdminError>
pub async fn list_operations( &self, status_filter: Option<OperationStatus>, ) -> Result<Vec<OperationSummary>, AdminError>
List all operations, optionally filtered by status
Sourcepub async fn get_resumable_operation(&self) -> Result<Option<Uuid>, AdminError>
pub async fn get_resumable_operation(&self) -> Result<Option<Uuid>, AdminError>
Get the most recent incomplete operation
Sourcepub fn get_pending_projects(&self, state: &OperationState) -> Vec<String>
pub fn get_pending_projects(&self, state: &OperationState) -> Vec<String>
Get project IDs that haven’t been processed yet
Sourcepub async fn cancel_operation(
&self,
operation_id: Uuid,
) -> Result<(), AdminError>
pub async fn cancel_operation( &self, operation_id: Uuid, ) -> Result<(), AdminError>
Cancel an operation (mark as cancelled)
Sourcepub async fn delete_operation(
&self,
operation_id: Uuid,
) -> Result<(), AdminError>
pub async fn delete_operation( &self, operation_id: Uuid, ) -> Result<(), AdminError>
Delete an operation state file
Auto Trait Implementations§
impl Freeze for StateManager
impl RefUnwindSafe for StateManager
impl Send for StateManager
impl Sync for StateManager
impl Unpin for StateManager
impl UnsafeUnpin 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