1 unstable release
Uses old Rust 2015
0.1.0 | Mar 4, 2018 |
---|
#1970 in Asynchronous
21 downloads per month
3MB
61K
SLoC
Async Mesos
This is an asynchronous client for Mesos V1 HTTP scheduler API. Checkout the docs or the tests for getting started.
lib.rs
:
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();
Dependencies
~10MB
~177K SLoC