1#![cfg_attr(
11 not(test),
12 deny(
13 clippy::unwrap_used,
14 clippy::unreachable,
15 clippy::expect_used,
16 clippy::panic,
17 clippy::unimplemented,
18 clippy::todo
19 )
20)]
21
22#[cfg(feature = "runtime-component")]
23mod component;
24mod dedupe;
25mod dispatch;
26mod error;
27mod execution;
28mod heartbeat;
29mod lease;
30mod registry;
31mod retry;
32#[cfg(feature = "runtime")]
33mod runtime;
34mod runtime_metadata;
35#[cfg(feature = "runtime")]
36mod schedule;
37mod spec;
38mod steps;
39mod temp;
40
41pub const BACKGROUND_TASKS_COMPONENT: &str = "background_tasks";
43
44#[cfg(feature = "runtime-component")]
45pub use component::{
46 BACKGROUND_TASKS_SHUTDOWN_PHASE, BackgroundTaskRuntimeComponent,
47 BackgroundTaskRuntimeComponentFromShutdown, BackgroundTaskRuntimeDefinitionsComponent,
48 BackgroundTaskRuntimeDefinitionsComponentFromShutdown, background_task_component,
49 background_task_component_from_shutdown, background_task_component_with_definitions,
50 background_task_component_with_definitions_from_shutdown,
51};
52pub use dedupe::{TASK_DEDUPE_KEY_MAX_LEN, TaskDedupeKey, scheduled_task_dedupe_key};
53pub use dispatch::{
54 ClaimableTaskRecord, ClaimedTask, DispatchStats, TaskClaimCandidate, TaskClaimStore,
55 TaskDispatchOutcome, TaskLaneConfig, available_lane_capacity, claim_due_for_lane,
56 claim_limit_to_u64, dispatch_lanes, drain_dispatcher, run_claimed_task_batch,
57 run_with_concurrency_limit,
58};
59pub use error::{Result, TaskCoreError};
60pub use execution::{
61 ClaimedTaskExecutionConfig, ClaimedTaskExecutionStore, ExecutableTaskRecord,
62 TaskPermanentFailure, TaskRetryUpdate, boxed_task_future, process_claimed_task,
63 run_claimed_task_batch_with_store,
64};
65pub use heartbeat::{
66 TaskHeartbeatStore, evaluate_heartbeat_result, run_task_heartbeat_loop,
67 spawn_task_heartbeat_with_interval, stop_task_heartbeat,
68};
69pub use lease::{
70 TaskExecutionContext, TaskLease, TaskLeaseGuard, task_lease_expires_at,
71 task_lease_renewal_timeout,
72};
73pub use registry::TaskRecord;
74pub use retry::{TaskRetryClass, default_task_retry_delay_secs};
75#[cfg(feature = "runtime")]
76pub use runtime::{
77 BACKGROUND_TASK_DISPATCH_ERROR_BACKOFF_CAP, BACKGROUND_TASK_SHUTDOWN_GRACE,
78 BackgroundTaskDispatchBackoff, BackgroundTaskDispatchIteration, BackgroundTaskDispatchTrigger,
79 BackgroundTasks, PeriodicTask, RecordedTaskHooks, effective_dispatch_base_interval,
80 effective_dispatch_max_interval, effective_jitter_cap, periodic_sleep_duration,
81 run_dispatch_worker, run_leased_background_tasks, run_periodic_task,
82 run_recorded_task_iteration,
83};
84pub use runtime_metadata::{RegisteredRuntimeTaskKind, RuntimeTaskDefinition, RuntimeTaskName};
85#[cfg(feature = "runtime")]
86pub use schedule::{
87 LeasedScheduledRuntimeConfig, ScheduledPeriodicTask, ScheduledRuntimeTaskGroup,
88 ScheduledTaskCatalogEntry, ScheduledTaskClaim, ScheduledTaskClaimRenewal,
89 ScheduledTaskClaimRequest, ScheduledTaskCompletion, ScheduledTaskStore, next_scheduled_run_at,
90 run_scheduled_claim_renewal_loop, run_scheduled_periodic_task, scheduled_claim_renew_interval,
91};
92pub use spec::{
93 BackgroundTaskSpec, ErasedBackgroundTaskSpec, TaskProcessFuture, TaskSpecAdapter,
94 decode_payload_as, decode_result_as, serialize_payload, serialize_result,
95};
96pub use steps::{
97 TaskStepInfo, TaskStepSpec, TaskStepStatus, initial_task_steps_from_specs,
98 mark_active_step_failed, set_task_step_active, set_task_step_skipped, set_task_step_succeeded,
99};
100pub use temp::{
101 cleanup_runtime_temp_root, cleanup_task_temp_dir_for_lease_in_root,
102 cleanup_task_temp_dir_for_task_in_root, cleanup_temp_dir, prepare_task_temp_dir_in_root,
103};