1 unstable release

0.0.1 Oct 4, 2020

#40 in #trigger

MIT license

370KB
1.5K SLoC

horoscope

Advanced Rust Scheduler


This crate provides a general purpose scheduler. The horoscope scheduler provides functionality out the box and is easily extensible.

Features

  • Fast: horoscope runs magnitudes faster than schedulers built in other languages that are mainstream. stream, horoscope runs magnitudes faster
  • Concurrent: executors run jobs in their own tasks in order to get as much work done as fast as possible.
  • Intuitive: You get a lot of powerful functionality out of the box to run CRON, Network tasks, retrieve jobs from memory, pg, and redis. If they are not what you are looking for, Implement your own Job, Trigger, Store, or Executor.
  • Easy to learn: Detailed documentation

Examples

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.

Philosophy

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.

Installation

With cargo add installed run:

$ cargo add horoscope

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~21–33MB
~525K SLoC