Skip to main content

LongOperationManager

Struct LongOperationManager 

Source
pub struct LongOperationManager { /* private fields */ }

Implementations§

Source§

impl LongOperationManager

Source

pub fn new() -> Self

Source

pub fn set_event_hub(&mut self, event_hub: &Arc<EventHub>)

Inject the event hub to allow sending long operation related events

Source

pub fn start_operation<Op: LongOperation>(&self, operation: Op) -> String

Start a new long operation and return its ID

Source

pub fn get_operation_status(&self, id: &str) -> Option<OperationStatus>

Get the status of an operation

Source

pub fn get_operation_progress(&self, id: &str) -> Option<OperationProgress>

Get the progress of an operation

Source

pub fn cancel_operation(&self, id: &str) -> bool

Cancel an operation

Source

pub fn is_operation_finished(&self, id: &str) -> Option<bool>

Check if an operation is finished

Source

pub fn cleanup_finished_operations(&self)

Remove finished operations from memory

Source

pub fn list_operations(&self) -> Vec<String>

Get list of all operation IDs

Source

pub fn get_operations_summary( &self, ) -> Vec<(String, OperationStatus, OperationProgress)>

Get summary of all operations

Source

pub fn store_operation_result<T: Serialize>( &self, id: &str, result: T, ) -> Result<()>

Store an operation result

Source

pub fn get_operation_result(&self, id: &str) -> Option<String>

Get an operation result

Trait Implementations§

Source§

impl Default for LongOperationManager

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> 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, 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.