Crate async_mesos [−] [src]
Asynchronous Mesos Client
This crate provides an asynchronous client for the Mesos Scheduler HTTP API.
Installation
Simply add the dependency to your Cargo.toml
[dependencies]
async_mesos = 0.1
Getting Started
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();
Modules
client |
Mesos client and event stream implementation. |
mesos | |
model |
Model builders for Mesos Protobufs. |
scheduler |