pub struct TaskRegistry { /* private fields */ }Expand description
Shared, thread-safe map of task_id -> record.
Cloning creates a new handle to the same underlying map.
Implementations§
Source§impl TaskRegistry
impl TaskRegistry
pub fn new() -> Self
Sourcepub fn register(&self, record: AsyncTaskRecord)
pub fn register(&self, record: AsyncTaskRecord)
Register a newly submitted task as Pending.
Sourcepub fn update(
&self,
task_id: &str,
status: AsyncTaskStatus,
result_summary: Option<String>,
)
pub fn update( &self, task_id: &str, status: AsyncTaskStatus, result_summary: Option<String>, )
Update a task’s status (and optional result summary) on completion.
Sourcepub fn remove(&self, task_id: &str)
pub fn remove(&self, task_id: &str)
Remove a task record (e.g. after it has been queried and aged out).
Sourcepub fn get(&self, task_id: &str) -> Option<AsyncTaskRecord>
pub fn get(&self, task_id: &str) -> Option<AsyncTaskRecord>
Look up a single task.
Sourcepub fn list_pending(&self) -> Vec<AsyncTaskRecord>
pub fn list_pending(&self) -> Vec<AsyncTaskRecord>
All currently Pending tasks.
Sourcepub fn list_all(&self) -> Vec<AsyncTaskRecord>
pub fn list_all(&self) -> Vec<AsyncTaskRecord>
All known tasks (any status).
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for TaskRegistry
impl Clone for TaskRegistry
Source§fn clone(&self) -> TaskRegistry
fn clone(&self) -> TaskRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for TaskRegistry
impl Default for TaskRegistry
Source§fn default() -> TaskRegistry
fn default() -> TaskRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TaskRegistry
impl RefUnwindSafe for TaskRegistry
impl Send for TaskRegistry
impl Sync for TaskRegistry
impl Unpin for TaskRegistry
impl UnsafeUnpin for TaskRegistry
impl UnwindSafe for TaskRegistry
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