Skip to main content

JobQueue

Trait JobQueue 

Source
pub trait JobQueue: Send + Sync {
    // Required methods
    fn enqueue<'life0, 'async_trait>(
        &'life0 self,
        run_id: RunId,
        due_ms: i64,
    ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn claim_due<'life0, 'async_trait>(
        &'life0 self,
        limit: usize,
        lease_ms: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Lease>, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        lease: &'life1 Lease,
    ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn fail<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        lease: &'life1 Lease,
        error: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn reschedule<'life0, 'life1, 'async_trait>(
        &'life0 self,
        lease: &'life1 Lease,
        due_ms: i64,
    ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Jobs keyed by run, at most one live job per run. claim_due leases due jobs and expired leases, earliest first; complete, fail and reschedule end a lease and return CoreError::Conflict for a stale one.

Required Methods§

Source

fn enqueue<'life0, 'async_trait>( &'life0 self, run_id: RunId, due_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source

fn claim_due<'life0, 'async_trait>( &'life0 self, limit: usize, lease_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<Lease>, CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, lease: &'life1 Lease, ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn fail<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, lease: &'life1 Lease, error: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Source

fn reschedule<'life0, 'life1, 'async_trait>( &'life0 self, lease: &'life1 Lease, due_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§