Struct async_mesos::client::Client
[−]
[src]
pub struct Client { pub uri: Uri, pub framework_id: String, pub stream_id: String, }
Mesos client connection.
This holds all connection information for a Mesos framework. The framework id should be persisted to recover after a failover.
Example
use async_mesos::mesos; use async_mesos::client::{Client, Events}; 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); let (client, events) = core.run(future_client).unwrap();
Fields
uri: Uri
The adress of the Mesos scheduler, e.g. http://localhost:5050/api/v1/scheduler
.
framework_id: String
Identification of the registered Mesos framework.
stream_id: String
Identification of the attached event stream.
Methods
impl Client
[src]
fn connect(
handle: &Handle,
uri: Uri,
framework_info: FrameworkInfo
) -> Box<Future<Item = (Self, Events), Error = Error>>
[src]
handle: &Handle,
uri: Uri,
framework_info: FrameworkInfo
) -> Box<Future<Item = (Self, Events), Error = Error>>
Connect to Mesos and subscribe to V1 scheduler events.
Argument
handle
- A handle to a Tokio loop.uri
- The uri to the Mesos V1 scheduler API, e.ghttp://localhost:5050/api/v1/scheduler
framework_info
- Information of the framework that registers with Mesos.
fn teardown(&self) -> Call
[src]
Construct teardown call.
The teardown call deregisters framework from Mesos.
fn accept(
&self,
offer_ids: Vec<OfferID>,
operations: Vec<Offer_Operation>
) -> Call
[src]
&self,
offer_ids: Vec<OfferID>,
operations: Vec<Offer_Operation>
) -> Call
Construct Accept call.
Arguments
offer_ids
- Vector over ids of offers that are accepted.operations
- The operations to perform on offers.
fn acknowledge(&self, update_status: TaskStatus) -> Call
[src]
Construct Acknowledge Call
Arguments
update_status
- The task status sent along with the update event.
fn call(
&self,
handle: &Handle,
call: Call
) -> Box<Future<Item = (), Error = Error>>
[src]
&self,
handle: &Handle,
call: Call
) -> Box<Future<Item = (), Error = Error>>
Make a call to Mesos.
Argument
handle
- A handle to a Tokio loop.call
- The content of the call, e.g. Accept for an offer.
Trait Implementations
impl Clone for Client
[src]
fn clone(&self) -> Client
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more