pub trait WorkQueue<C: Context, WI: WorkItem>:
Clone
+ Send
+ Sync
+ 'static {
// Required methods
fn enqueue<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 str,
work: WI,
) -> Pin<Box<dyn Future<Output = Result<(), WorkQueueError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<(String, WI)>, WorkQueueError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn purge_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), WorkQueueError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn pending_work<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<WI>, WorkQueueError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Trait for a distributed workflow work queue.
Implementations provide FIFO queueing of work items for distributed workers.
Required Methods§
Sourcefn enqueue<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 str,
work: WI,
) -> Pin<Box<dyn Future<Output = Result<(), WorkQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn enqueue<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 str,
work: WI,
) -> Pin<Box<dyn Future<Output = Result<(), WorkQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Enqueue one work-item under this workflow_id.
Returns Err(WorkQueueError) on failure.
Sourcefn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<(String, WI)>, WorkQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<(String, WI)>, WorkQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dequeue the next available work-item from any workflow. Returns Ok(Some((workflow_id, item))) if an item was dequeued, Ok(None) if the queue is empty, or Err(WorkQueueError) on failure.
Sourcefn purge_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), WorkQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn purge_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), WorkQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Purge all work items for a given workflow run. Removes all queued work for the specified run_id.
Sourcefn pending_work<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<WI>, WorkQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pending_work<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<WI>, WorkQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get pending work for a run.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.