Crates.io | horoscope |
lib.rs | horoscope |
version | 0.0.1 |
source | src |
created_at | 2020-10-04 22:00:40.453657 |
updated_at | 2020-10-04 22:00:40.453657 |
description | The all knowing scheduler |
homepage | |
repository | |
max_upload_size | |
id | 296152 |
size | 374,299 |
This crate provides a general purpose scheduler. The horoscope scheduler provides functionality out the box and is easily extensible.
use horoscope::executor::Executor;
use horoscope::job::network::{Job, NetType};
use horoscope::scheduler::{Schedule, blocking, daemon, Msg};
use horoscope::store::memory::Store;
fn main() {
let store = Store::new(String::from("jobStore-test"));
let exec = Executor::new(String::from("executor-test"));
let njob = Job::new(
String::from("job-1"),
String::from("https://ping.me/"),
NetType::Get,
None,
);
let mut blk_scheduler = blocking::Scheduler::new();
blk_scheduler
.add_store(String::from("jobStore-test"), Box::new(store))
.unwrap();
blk_scheduler
.add_executor(String::from("executor-test"), exec)
.unwrap();
let scheduler = daemon(blk_scheduler);
scheduler
.send(Msg::AddJob(
String::from("job-1"),
String::from("jobStore-test"),
String::from("executor-test"),
start_time,
None,
Box::new(njob),
))
.await;
}
More examples, including networking and file access, can be found in our
examples
directory and in our documentation.
We believe it's helpful to have general implementations of common use-cases, but will always allow you to take over and implement to your liking.
With cargo add installed run:
$ cargo add horoscope