pub struct LocalDistributedQueue { /* private fields */ }Expand description
Local distributed queue implementation using multi-core parallelism
This is the default implementation that uses local channels for communication between partitions. Each partition runs on a separate tokio task, enabling efficient multi-core utilization.
Implementations§
Source§impl LocalDistributedQueue
impl LocalDistributedQueue
Sourcepub fn new(partition_config: PartitionConfig) -> Self
pub fn new(partition_config: PartitionConfig) -> Self
Create a new local distributed queue with the specified partition configuration
Sourcepub fn partitioner(&self) -> &Arc<dyn Partitioner>
pub fn partitioner(&self) -> &Arc<dyn Partitioner>
Get the partitioner
Sourcepub fn partition_config(&self) -> &PartitionConfig
pub fn partition_config(&self) -> &PartitionConfig
Get the partition configuration
Sourcepub fn partition_receiver(
&self,
partition_id: PartitionId,
) -> Option<Arc<Mutex<Receiver<CommandEnvelope>>>>
pub fn partition_receiver( &self, partition_id: PartitionId, ) -> Option<Arc<Mutex<Receiver<CommandEnvelope>>>>
Get the receiver for a specific partition (for worker tasks)
Sourcepub fn result_receiver(&self) -> Arc<Mutex<Receiver<CommandResult>>>
pub fn result_receiver(&self) -> Arc<Mutex<Receiver<CommandResult>>>
Get the result receiver (for coordinator to collect results)
Sourcepub fn result_sender(&self) -> Sender<CommandResult>
pub fn result_sender(&self) -> Sender<CommandResult>
Get the result sender (for workers to send results)
Trait Implementations§
Source§impl DistributedQueue for LocalDistributedQueue
impl DistributedQueue for LocalDistributedQueue
Source§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 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
Source§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 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)
Source§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 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
Source§fn num_partitions(&self) -> usize
fn num_partitions(&self) -> usize
Get the number of partitions
Source§fn is_coordinator(&self) -> bool
fn is_coordinator(&self) -> bool
Check if this instance is a coordinator (can enqueue commands)
Auto Trait Implementations§
impl Freeze for LocalDistributedQueue
impl !RefUnwindSafe for LocalDistributedQueue
impl Send for LocalDistributedQueue
impl Sync for LocalDistributedQueue
impl Unpin for LocalDistributedQueue
impl UnsafeUnpin for LocalDistributedQueue
impl !UnwindSafe for LocalDistributedQueue
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