1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
//! Core library for the Rain framework.
//!
//! This documentation is minimalistic but still hopefully useful.
//! As an user, you may be interested in the
//! [rain_task lirary documentation](https://docs.rs/rain_task/).
//!
//! See `README.md` and the [project page](https://github.com/substantic/rain/)
//! for general information.

#[macro_use]
extern crate arrayref;
extern crate bytes;
#[macro_use]
extern crate capnp;
extern crate capnp_rpc;
extern crate chrono;
#[macro_use]
extern crate error_chain;
extern crate futures;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate nix;
extern crate rusqlite;
extern crate serde;
extern crate serde_bytes;
extern crate serde_cbor;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate tokio_core;
extern crate tokio_timer;

pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const GOVERNOR_PROTOCOL_VERSION: i32 = 0;
pub const CLIENT_PROTOCOL_VERSION: i32 = 1;
pub const EXECUTOR_PROTOCOL_VERSION: i32 = 0;

pub mod comm;
pub mod errors;
pub mod logging;
pub mod sys;
pub mod types;
pub mod utils;

pub use errors::{Error, ErrorKind, Result, ResultExt};

pub mod server_capnp {
    include!(concat!(env!("OUT_DIR"), "/capnp/server_capnp.rs"));
}

pub mod client_capnp {
    include!(concat!(env!("OUT_DIR"), "/capnp/client_capnp.rs"));
}

pub mod common_capnp {
    use std::fmt;

    include!(concat!(env!("OUT_DIR"), "/capnp/common_capnp.rs"));

    impl fmt::Debug for DataObjectState {
        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
            write!(
                f,
                "{}",
                match *self {
                    DataObjectState::Unfinished => "Unfinished",
                    DataObjectState::Finished => "Finished",
                    DataObjectState::Removed => "Removed",
                }
            )
        }
    }

    impl fmt::Debug for TaskState {
        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
            write!(
                f,
                "{}",
                match *self {
                    TaskState::NotAssigned => "NotAssigned",
                    TaskState::Assigned => "Assigned",
                    TaskState::Ready => "Ready",
                    TaskState::Running => "Running",
                    TaskState::Finished => "Finished",
                    TaskState::Failed => "Failed",
                }
            )
        }
    }
}

pub mod governor_capnp {
    include!(concat!(env!("OUT_DIR"), "/capnp/governor_capnp.rs"));
}

pub mod monitor_capnp {
    include!(concat!(env!("OUT_DIR"), "/capnp/monitor_capnp.rs"));
}