Crate sisyphus_tasks

Crate sisyphus_tasks 

Source
Expand description

Utilities for long-running, resilient tasks.

This library contains code I wrote, found useful, and want to keep using. It aims to provide quick and re-usable scaffolding for building daemons. It is heavily optimized for my preferred dev ergonomics, and is not heavily optimized for performance.

The general style is focused on spawning long-lived worker loops, which use channels to communicate.

impl Boulder for MyWorkerTask {
  fn spawn(self) -> JoinHandle<Fall<Self>> {
    tokio::spawn(async move {
      while let Some(item) = self.pipe.next().await {
        // work happens here :)
      }
    });
  }
}

let task = MyWorkerTask::new().run_forever();

Re-exports§

pub use crate::sisyphus::Boulder;
pub use crate::sisyphus::Fall;
pub use crate::sisyphus::Sisyphus;
pub use pipe::Pipe;
pub use pipe::PipeError;

Modules§

metrics
Simple Prometheus metrics
pipe
Pipe with process-once semantics
sisyphus
Resumable, never-ending, tasks