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
//! Asynchronous Mesos Client //! //! This crate provides an asynchronous client for the Mesos //! [Scheduler HTTP API](http://mesos.apache.org/documentation/latest/scheduler-http-api). //! //! ## Installation //! //! Simply add the dependency to your `Cargo.toml` //! //! ```toml //! [dependencies] //! async_mesos = 0.1 //! ``` //! //! ## Getting Started //! //! ```no_run //! # extern crate async_mesos; //! # extern crate futures; //! # extern crate hyper; //! # extern crate tokio_core; //! # fn main() { //! use async_mesos::mesos; //! use async_mesos::client::Client; //! use futures::{future, Future, Stream}; //! use hyper::Uri; //! use tokio_core::reactor::Core; //! //! // Create a Tokio core handle. //! let mut core = Core::new().expect("Could not create core."); //! let handle = core.handle(); //! //! // Create the Mesos framework info to register a new framework. //! let mut framework_info = mesos::FrameworkInfo::new(); //! framework_info.set_user(String::from("donnie")); //! framework_info.set_name(String::from("Example FOO Framework")); //! //! // Connect to Mesos scheduler API. //! let uri = "http://localhost:5050/api/v1/scheduler" //! .parse::<Uri>() //! .expect("Could not parse Uri."); //! let future_client = Client::connect(&handle, uri, framework_info); //! //! // Process first HEARTBEAT event //! let work = future_client //! .into_stream() //! .map(|(_, events)| events) //! .flatten() //! .map(|event| event.get_field_type()) //! .take(1) //! .collect(); //! //! core.run(work).unwrap(); //! # } //! ``` extern crate bytes; #[macro_use] extern crate failure; #[macro_use] extern crate futures; #[macro_use] extern crate hyper; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; extern crate mime; extern crate protobuf; extern crate tokio_core; pub mod client; pub mod model; mod decoder; pub mod mesos; pub mod scheduler; #[cfg(test)] mod tests { pub extern crate spectral; }