Skip to main content

actionqueue_executor_local/
lib.rs

1#![forbid(unsafe_code)]
2//! Local executor for the ActionQueue task queue.
3//!
4//! This crate provides the execution infrastructure for running task attempts
5//! on the local node. It handles:
6//!
7//! - **Dispatch queue** ([`pool::DispatchQueue`]) — FIFO intake with backpressure
8//! - **Attempt execution** ([`AttemptRunner`]) — Request/response pipeline with
9//!   timeout enforcement and cancellation cooperation tracking
10//! - **Timeout enforcement** ([`timeout::TimeoutGuard`]) — Watchdog-based timeout with
11//!   panic-safe cleanup and cooperation metrics
12//! - **Retry decisions** ([`retry::decide_retry_transition`]) — Cap-enforced retry logic
13//!   with no N+1 paths
14//! - **Backoff strategies** ([`backoff::BackoffStrategy`]) — Pluggable delay computation
15//!   with overflow-safe arithmetic
16//!
17//! # Handler Contract
18//!
19//! Implement [`handler::ExecutorHandler`] to define task execution logic. Handlers must be
20//! `Send + Sync` and should poll the [`handler::cancellation::CancellationToken`] at bounded
21//! cadence for cooperative timeout support.
22
23pub mod attempt_runner;
24pub mod backoff;
25pub mod children;
26pub mod handler;
27pub mod identity;
28pub mod pool;
29pub mod retry;
30pub mod timeout;
31pub mod types;
32
33pub use attempt_runner::{
34    AttemptOutcomeKind, AttemptOutcomeRecord, AttemptRunner, AttemptTimer, RetryDecisionInput,
35    SystemAttemptTimer, TimeoutCadencePolicy, TimeoutCooperation, TimeoutCooperationMetrics,
36    TimeoutCooperationMetricsSnapshot, TimeoutEnforcementReport,
37};
38pub use backoff::{BackoffConfigError, BackoffStrategy, ExponentialBackoff, FixedBackoff};
39pub use children::{ChildState, ChildrenSnapshot};
40pub use handler::{
41    AttemptMetadata, ExecutorContext, ExecutorHandler, HandlerInput, HandlerOutput,
42    TaskSubmissionPort,
43};
44pub use handler::{CancellationContext, CancellationToken};
45pub use identity::{ExecutorIdentity, LocalExecutorIdentity};
46pub use pool::{DispatchQueue, DispatchQueueError};
47pub use retry::{can_retry, decide_retry_transition, RetryDecision, RetryDecisionError};
48pub use timeout::{
49    classify_timeout, GuardedExecution, SystemTimeoutClock, TimeoutClassification, TimeoutClock,
50    TimeoutFailure, TimeoutGuard, TimeoutReasonCode,
51};
52pub use types::{ExecutorRequest, ExecutorResponse};