Crates.io | distributed-scheduler |
lib.rs | distributed-scheduler |
version | |
source | src |
created_at | 2024-06-25 15:16:11.881614+00 |
updated_at | 2025-02-22 19:47:38.685327+00 |
description | A distributed cronjob library |
homepage | https://github.com/AH-dark/distributed-scheduler |
repository | https://github.com/AH-dark/distributed-scheduler.git |
max_upload_size | |
id | 1283411 |
Cargo.toml error: | TOML parse error at line 23, column 1 | 23 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This is a distributed scheduler that can be used to schedule tasks on a cluster of machines. The scheduler is implemented in Rust and uses the tokio library for asynchronous IO. The scheduler is designed to be fault-tolerant and can recover from failures of the scheduler itself or the machines in the cluster.
The current cronjob provider is job_scheduler, but it is no longer maintained, so I may replace it with another crate in the future.
The scheduler is composed of a number of components that work together to schedule tasks. The main components are:
To use the scheduler, you can view the example crate in the examples
directory. Here is an brief example:
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let rdb = redis::Client::open("redis://localhost:6379").unwrap();
let driver = distributed_schedular::driver::redis::RedisDriver::new(rdb).await?;
let np = distributed_schedular::node_pool::NodePool::new(driver);
let cron = distributed_schedular::cron::Cron::new(np).await?;
cron.add_job("test", "* * * * * *".parse().unwrap(), || {
println!("Hello, I run every seconds");
}).await?;
Ok(())
}
This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.