pub struct LocalFileFlowTaskQueue { /* private fields */ }Expand description
JSON-backed local durable task queue.
Tasks are stored as one JSON file per pending item under <root>/pending.
The queue serializes access inside the current process. It is intended for
embedded hosts and local crash/restart durability of pending tasks; it does
not provide cross-process locking. Heartbeats atomically rename inflight
files, making the replacement file name a new fencing token and lease-age
timestamp.
Implementations§
Source§impl LocalFileFlowTaskQueue
impl LocalFileFlowTaskQueue
Sourcepub async fn inflight_len(&self) -> Result<usize>
pub async fn inflight_len(&self) -> Result<usize>
Returns the number of currently leased task files.
Sourcepub async fn dead_letter_len(&self) -> Result<usize>
pub async fn dead_letter_len(&self) -> Result<usize>
Returns the number of dead-lettered task files.
Sourcepub async fn dead_lettered_tasks(
&self,
) -> Result<Vec<LocalFileDeadLetteredTask>>
pub async fn dead_lettered_tasks( &self, ) -> Result<Vec<LocalFileDeadLetteredTask>>
Loads dead-lettered tasks in durable file order.
Trait Implementations§
Source§impl Clone for LocalFileFlowTaskQueue
impl Clone for LocalFileFlowTaskQueue
Source§fn clone(&self) -> LocalFileFlowTaskQueue
fn clone(&self) -> LocalFileFlowTaskQueue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LocalFileFlowTaskQueue
impl Debug for LocalFileFlowTaskQueue
Source§impl FlowTaskQueue for LocalFileFlowTaskQueue
impl FlowTaskQueue for LocalFileFlowTaskQueue
Source§fn enqueue<'life0, 'async_trait>(
&'life0 self,
task: FlowTask,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn enqueue<'life0, 'async_trait>(
&'life0 self,
task: FlowTask,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Appends one task to pending dispatch.
Source§fn lease<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<FlowTaskLease>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn lease<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<FlowTaskLease>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Leases the next pending task without acknowledging it.
Source§fn heartbeat<'life0, 'life1, 'async_trait>(
&'life0 self,
lease_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn heartbeat<'life0, 'life1, 'async_trait>(
&'life0 self,
lease_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Refreshes an active lease and returns its replacement fencing token. Read more
Source§fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
lease_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
lease_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Acknowledges the active lease identified by its latest fencing token. Read more
Source§fn requeue_inflight<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn requeue_inflight<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns inflight tasks to pending dispatch and reports the count.
Source§fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the number of tasks pending dispatch.
Auto Trait Implementations§
impl !RefUnwindSafe for LocalFileFlowTaskQueue
impl !UnwindSafe for LocalFileFlowTaskQueue
impl Freeze for LocalFileFlowTaskQueue
impl Send for LocalFileFlowTaskQueue
impl Sync for LocalFileFlowTaskQueue
impl Unpin for LocalFileFlowTaskQueue
impl UnsafeUnpin for LocalFileFlowTaskQueue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FlowTaskDispatcher for Twhere
T: FlowTaskQueue + ?Sized,
impl<T> FlowTaskDispatcher for Twhere
T: FlowTaskQueue + ?Sized,
Source§fn dispatch<'life0, 'async_trait>(
&'life0 self,
task: FlowTask,
) -> Pin<Box<dyn Future<Output = Result<(), FlowError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn dispatch<'life0, 'async_trait>(
&'life0 self,
task: FlowTask,
) -> Pin<Box<dyn Future<Output = Result<(), FlowError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Dispatches one Flow task to the configured execution route.
Source§fn has_runtime_build_route(
&self,
required_build_id: Option<&RuntimeBuildId>,
) -> bool
fn has_runtime_build_route( &self, required_build_id: Option<&RuntimeBuildId>, ) -> bool
Return whether this dispatcher has an explicit compatible route.
Source§fn ensure_runtime_build_route(
&self,
required_build_id: Option<&RuntimeBuildId>,
) -> Result<()>
fn ensure_runtime_build_route( &self, required_build_id: Option<&RuntimeBuildId>, ) -> Result<()>
Fail before dispatch when no compatible route is registered.
Source§fn dispatch_for_runtime_build<'life0, 'life1, 'async_trait>(
&'life0 self,
required_build_id: Option<&'life1 RuntimeBuildId>,
task: FlowTask,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn dispatch_for_runtime_build<'life0, 'life1, 'async_trait>(
&'life0 self,
required_build_id: Option<&'life1 RuntimeBuildId>,
task: FlowTask,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Dispatch to a route that explicitly serves
required_build_id. Read more