json_job_dispatch/lib.rs
1// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
2// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
4// option. This file may not be copied, modified, or distributed
5// except according to those terms.
6
7#![warn(missing_docs)]
8// XXX(rust-1.66)
9#![allow(clippy::uninlined_format_args)]
10
11//! A small library to dispatch job files to relevant handlers.
12//!
13//! This library implements the core logic of a `Director` which dispatches jobs described in JSON
14//! files to a relevant `Handler` and then archives the job based on whether it was accepted or
15//! rejected.
16//!
17//! # Job files
18//!
19//! Job files are files ending in a `.json` extension in JSON format. Two keys are required:
20//!
21//! - `kind`: this string value is used to determine which handler will be used to handle the
22//! job.
23//! - `data`: this value is passed to the handler.
24//!
25//! Other keys may be used (e.g., a `timestamp` to indicate when the job was created).
26//!
27//! Job files are treated as read-only by the director.
28
29mod director;
30mod handler;
31mod handlers;
32pub mod utils;
33mod watcher;
34
35mod try_fold;
36
37pub use director::Director;
38pub use director::DirectorError;
39pub use director::Outbox;
40pub use director::RunResult;
41pub use handler::Handler;
42pub use handler::HandlerCore;
43pub use handler::JobError;
44pub use handler::JobResult;
45pub use handlers::DirectorWatchdog;
46
47#[cfg(test)]
48mod test;