Skip to main content

FjallRoundRobinTaskQueue

Struct FjallRoundRobinTaskQueue 

Source
pub struct FjallRoundRobinTaskQueue<D, S>{ /* 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) -> serialized Task<D>
  • queue: <u16 BE tag-len><tag utf8><uuid v7 bytes> -> empty
  • inflight: task_id -> <u16 BE tag-len><tag utf8> (so recover knows the bucket)
  • dlq: task_id -> serialized Task<D>

Implementations§

Source§

impl<D, S> FjallRoundRobinTaskQueue<D, S>

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, TaskQueueError>

Trait Implementations§

Source§

impl<D, S> Debug for FjallRoundRobinTaskQueue<D, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<D, S> TaskQueue<D> for FjallRoundRobinTaskQueue<D, S>

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.