pub struct JobRegistry { /* private fields */ }Expand description
Thread-safe job registry.
Stores running jobs and keeps completed jobs for a retention window.
Implementations§
Source§impl JobRegistry
impl JobRegistry
pub fn new(completed_retention: Duration) -> Self
pub fn completed_retention(&self) -> Duration
pub async fn insert(&self, job_id: String, job: SharedJobState)
pub async fn get(&self, job_id: &str) -> Option<SharedJobState>
pub async fn remove(&self, job_id: &str) -> Option<SharedJobState>
Sourcepub async fn prune_expired(&self) -> usize
pub async fn prune_expired(&self) -> usize
Remove completed jobs that exceeded the retention window.
Returns the number of pruned jobs.
Trait Implementations§
Source§impl Clone for JobRegistry
impl Clone for JobRegistry
Source§fn clone(&self) -> JobRegistry
fn clone(&self) -> JobRegistry
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for JobRegistry
impl !UnwindSafe for JobRegistry
impl Freeze for JobRegistry
impl Send for JobRegistry
impl Sync for JobRegistry
impl Unpin for JobRegistry
impl UnsafeUnpin for JobRegistry
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