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
pub fn new(root: impl Into<PathBuf>) -> Self
pub fn root(&self) -> &Path
pub async fn inflight_len(&self) -> Result<usize>
pub async fn dead_letter_len(&self) -> Result<usize>
pub async fn dead_lettered_tasks( &self, ) -> Result<Vec<LocalFileDeadLetteredTask>>
pub async fn requeue_inflight_older_than( &self, cutoff: DateTime<Utc>, ) -> Result<usize>
pub async fn dead_letter_inflight_older_than( &self, cutoff: DateTime<Utc>, reason: impl Into<String>, ) -> Result<usize>
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
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 lease<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<FlowTaskLease>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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
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 len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<FlowTask>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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,
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,
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