pub trait DistributedQueue: Send + Sync {
// Required methods
fn enqueue<'life0, 'async_trait>(
&'life0 self,
envelope: CommandEnvelope,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn dequeue<'life0, 'async_trait>(
&'life0 self,
partition_id: PartitionId,
) -> Pin<Box<dyn Future<Output = Result<Option<CommandEnvelope>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn complete<'life0, 'async_trait>(
&'life0 self,
result: CommandResult,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn num_partitions(&self) -> usize;
fn worker_id(&self) -> &WorkerId;
fn is_coordinator(&self) -> bool;
fn is_worker(&self) -> bool;
}Expand description
Distributed queue trait for multi-machine parallel processing
Implement this trait to enable distributed queue processing across multiple machines.
The default implementation (LocalDistributedQueue) uses local multi-core parallelism.
Required Methods§
Sourcefn enqueue<'life0, 'async_trait>(
&'life0 self,
envelope: CommandEnvelope,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn enqueue<'life0, 'async_trait>(
&'life0 self,
envelope: CommandEnvelope,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Enqueue a command to be processed by a worker
Sourcefn dequeue<'life0, 'async_trait>(
&'life0 self,
partition_id: PartitionId,
) -> Pin<Box<dyn Future<Output = Result<Option<CommandEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dequeue<'life0, 'async_trait>(
&'life0 self,
partition_id: PartitionId,
) -> Pin<Box<dyn Future<Output = Result<Option<CommandEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dequeue a command for processing (called by workers)
Sourcefn complete<'life0, 'async_trait>(
&'life0 self,
result: CommandResult,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
result: CommandResult,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Report command completion
Sourcefn num_partitions(&self) -> usize
fn num_partitions(&self) -> usize
Get the number of partitions
Sourcefn is_coordinator(&self) -> bool
fn is_coordinator(&self) -> bool
Check if this instance is a coordinator (can enqueue commands)