sisyphus_tasks/lib.rs
1#![warn(missing_docs, unreachable_pub)]
2#![deny(unused_must_use, rust_2018_idioms)]
3
4//! Utilities for long-running, resilient tasks.
5//!
6//! This library contains code I wrote, found useful, and want to keep using.
7//! It aims to provide quick and re-usable scaffolding for building daemons.
8//! It is heavily optimized for my preferred dev ergonomics, and is not heavily
9//! optimized for performance.
10//!
11//! The general style is focused on spawning long-lived worker loops, which use
12//! channels to communicate.
13//!
14//! ```no_compile
15//! impl Boulder for MyWorkerTask {
16//! fn spawn(self) -> JoinHandle<Fall<Self>> {
17//! tokio::spawn(async move {
18//! while let Some(item) = self.pipe.next().await {
19//! // work happens here :)
20//! }
21//! });
22//! }
23//! }
24//!
25//! let task = MyWorkerTask::new().run_forever();
26//! ```
27
28pub mod metrics;
29/// Pipe with process-once semantics
30pub mod pipe;
31/// Resumable, never-ending, tasks
32pub mod sisyphus;
33/// Crate-internal utils
34mod utils;
35
36pub use crate::sisyphus::{Boulder, Fall, Sisyphus};
37pub use pipe::{Pipe, PipeError};