pub struct FjallRoundRobinTaskQueue<D, S>where
D: HasTagKey,
S: TaskSerializer,{ /* private fields */ }Expand description
Round-robin Fjall task queue.
Pops scan forward from a cursor across all known tags, skipping any tag whose sub-queue is currently empty, and stop at the first tag with a queued task. A tag is never dropped from rotation just because it’s momentarily empty — it’s checked again on every subsequent pop until it either has work or the queue is added to. This keeps one busy tag from starving others, even when tags refill at very different rates. FIFO within a tag is preserved by sorting on the task’s UUID v7 suffix.
Layout:
tasks: task_id (uuid bytes) -> serializedTask<D>queue:<u16 BE tag-len><tag utf8><uuid v7 bytes>-> emptyinflight: task_id -><u16 BE tag-len><tag utf8>(so recover knows the bucket)dlq: task_id -> serializedTask<D>
Implementations§
Source§impl<D, S> FjallRoundRobinTaskQueue<D, S>where
D: HasTagKey,
S: TaskSerializer,
impl<D, S> FjallRoundRobinTaskQueue<D, S>where
D: HasTagKey,
S: TaskSerializer,
Trait Implementations§
Source§impl<D, S> Debug for FjallRoundRobinTaskQueue<D, S>where
D: HasTagKey,
S: TaskSerializer,
impl<D, S> Debug for FjallRoundRobinTaskQueue<D, S>where
D: HasTagKey,
S: TaskSerializer,
Source§impl<D, S> TaskQueue<D> for FjallRoundRobinTaskQueue<D, S>where
D: HasTagKey + Debug + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
S: TaskSerializer + Send + Sync,
impl<D, S> TaskQueue<D> for FjallRoundRobinTaskQueue<D, S>where
D: HasTagKey + Debug + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
S: TaskSerializer + Send + Sync,
fn push<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task<D>,
) -> Pin<Box<dyn Future<Output = Result<(), TaskQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Task<D>, TaskQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<(), TaskQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn nack<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task<D>,
) -> Pin<Box<dyn Future<Output = Result<(), TaskQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task<D>,
) -> Pin<Box<dyn Future<Output = Result<(), TaskQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn recover_inflight<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, TaskQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recover_inflight<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, TaskQueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Move any tasks left in the in-flight set back to the queue. Called once
at runtime startup to recover work owned by a previous process that
crashed before acking. Returns the number of tasks recovered.
Auto Trait Implementations§
impl<D, S> !Freeze for FjallRoundRobinTaskQueue<D, S>
impl<D, S> !RefUnwindSafe for FjallRoundRobinTaskQueue<D, S>
impl<D, S> !UnwindSafe for FjallRoundRobinTaskQueue<D, S>
impl<D, S> Send for FjallRoundRobinTaskQueue<D, S>
impl<D, S> Sync for FjallRoundRobinTaskQueue<D, S>
impl<D, S> Unpin for FjallRoundRobinTaskQueue<D, S>
impl<D, S> UnsafeUnpin for FjallRoundRobinTaskQueue<D, S>
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