tk_cantal/
lib.rs

1//! # Cantal Client
2//!
3//! [Documentation](https://docs.rs/tk-cantal) |
4//! [Github](https://github.com/tailhook/tk-cantal) |
5//! [Crate](https://crates.io/crates/tk-cantal)
6//!
7//! This client is usually used to find out peers known to cantal, i.e. peers
8//! of the current cluster.
9//!
10//! This is **not** a way to submit metrics to cantal. See [`libcantal`] for
11//! that.
12//!
13//! We will expose more APIs, like fetching metrics later.
14//!
15//! [`libcantal`]: https://crates.io/crates/libcantal
16#![warn(missing_docs)]
17#![warn(missing_debug_implementations)]
18extern crate abstract_ns;
19extern crate futures;
20extern crate serde;
21extern crate serde_json;
22extern crate serde_millis;
23extern crate tk_http;
24extern crate tk_pool;
25extern crate tokio_core;
26extern crate tokio_io;
27
28#[macro_use] extern crate log;
29#[macro_use] extern crate serde_derive;
30#[macro_use] extern crate failure;
31
32use std::fmt;
33
34mod connect;
35mod peers;
36mod response;
37mod errors;
38mod pool_log;
39
40pub use connect::connect_local;
41pub use response::ResponseFuture;
42pub use peers::{PeersResponse, Peer};
43
44
45/// Connection abstraction used to fetch data from the cantal
46///
47/// Internally this structure contains a connection pool that reconnects
48/// when connection is broken.
49pub struct Connection {
50    pool: connect::Pool,
51}
52
53impl fmt::Debug for Connection {
54    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
55        f.debug_struct("Connection").finish()
56    }
57}