Expand description
Pollen: Embedded Decentralized Distributed Task Scheduler
Pollen is like SQLite for task scheduling, but with peer-to-peer cluster capabilities.
§Quick Start
use pollen::{Pollen, Schedule, Storage};
use std::time::Duration;
#[tokio::main]
async fn main() -> pollen::Result<()> {
// Single-node mode
let scheduler = Pollen::builder()
.storage(Storage::sqlite("./pollen.db"))
.build()
.await?;
// Define a task with cron schedule
scheduler.define("daily_report")
.schedule(Schedule::cron("0 9 * * *"))
.handler(|| async { Ok(()) })
.register()
.await?;
Ok(())
}§Features
metrics- Enable Prometheus metrics collectionotel- Enable OpenTelemetry integrationfull- Enable all optional features
Modules§
- prelude
- Re-export commonly used types
Structs§
- Cluster
Config - Cluster configuration for the builder
- Cluster
State - Cluster state information
- Executor
Settings - Executor configuration
- Instance
Id - Unique identifier for a task instance (single execution).
- NodeId
- Unique identifier for a node in the cluster.
- Node
Info - Node information in cluster
- Pollen
- Main Pollen scheduler instance
- Pollen
Builder - Builder for constructing a Pollen scheduler instance
- Retry
Policy - Retry policy for failed tasks.
- Task
Builder - Task builder for fluent task definition
- Task
Config - Task configuration options.
- TaskDef
- Task definition - the blueprint for a scheduled task.
- TaskId
- Unique identifier for a task definition.
- Task
Info - Task information
- Task
Instance - Task instance - a single execution of a task.
Enums§
- Node
State - Node state in cluster
- Pollen
Error - Main error type for Pollen operations.
- Schedule
- Schedule configuration for a task.
- Storage
- Storage configuration
- Task
Status - Status of a task instance.
Type Aliases§
- Result
- Result type for Pollen operations.