pub struct LongOperationManager { /* private fields */ }Implementations§
Source§impl LongOperationManager
impl LongOperationManager
pub fn new() -> Self
Sourcepub fn set_event_hub(&mut self, event_hub: &Arc<EventHub>)
pub fn set_event_hub(&mut self, event_hub: &Arc<EventHub>)
Inject the event hub to allow sending long operation related events
Sourcepub fn start_operation<Op: LongOperation>(&self, operation: Op) -> String
pub fn start_operation<Op: LongOperation>(&self, operation: Op) -> String
Start a new long operation and return its ID
Sourcepub fn get_operation_status(&self, id: &str) -> Option<OperationStatus>
pub fn get_operation_status(&self, id: &str) -> Option<OperationStatus>
Get the status of an operation
Sourcepub fn get_operation_progress(&self, id: &str) -> Option<OperationProgress>
pub fn get_operation_progress(&self, id: &str) -> Option<OperationProgress>
Get the progress of an operation
Sourcepub fn cancel_operation(&self, id: &str) -> bool
pub fn cancel_operation(&self, id: &str) -> bool
Cancel an operation
Sourcepub fn is_operation_finished(&self, id: &str) -> Option<bool>
pub fn is_operation_finished(&self, id: &str) -> Option<bool>
Check if an operation is finished
Sourcepub fn cleanup_finished_operations(&self)
pub fn cleanup_finished_operations(&self)
Remove finished operations from memory
Sourcepub fn list_operations(&self) -> Vec<String>
pub fn list_operations(&self) -> Vec<String>
Get list of all operation IDs
Sourcepub fn get_operations_summary(
&self,
) -> Vec<(String, OperationStatus, OperationProgress)>
pub fn get_operations_summary( &self, ) -> Vec<(String, OperationStatus, OperationProgress)>
Get summary of all operations
Sourcepub fn store_operation_result<T: Serialize>(
&self,
id: &str,
result: T,
) -> Result<()>
pub fn store_operation_result<T: Serialize>( &self, id: &str, result: T, ) -> Result<()>
Store an operation result
Sourcepub fn get_operation_result(&self, id: &str) -> Option<String>
pub fn get_operation_result(&self, id: &str) -> Option<String>
Get an operation result
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LongOperationManager
impl RefUnwindSafe for LongOperationManager
impl Send for LongOperationManager
impl Sync for LongOperationManager
impl Unpin for LongOperationManager
impl UnsafeUnpin for LongOperationManager
impl UnwindSafe for LongOperationManager
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