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
// Copyright 2020 nytopop (Eric Izoita)
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
//! A Rust framework for writing fast and highly resilient in-process gRPC service meshes.
//!
//! # Overview
//! `blip` provides an implementation of distributed membership based on [rapid], exposed
//! as a gRPC service. Groups of servers become aware of each other through the membership
//! protocol, and any given member may expose its own metadata or linked services through
//! the same backing gRPC server.
//!
//! In essence, this crate provides a membership list with strong consistency semantics
//! (as opposed to weakly consistent protocols like [SWIM]), distributed fault detection,
//! and grpc routing.
//!
//! # Service Discovery
//! `blip` is designed to build heterogenous meshes. As such, members may expose arbitrary
//! (immutable) key-value metadata when they join a mesh, which can be used for the purpose
//! of service discovery.
//!
//! # Sharding and State
//! `blip` does not enforce any invariants with regard to state held by members of a mesh.
//! For maximal flexibility, state and sharding are deferred to implementations of member
//! services.
//!
//! # Feature Flags
//! * `simulation`: Enables the simulation network for testing purposes.
//!
//! # References
//! * [Stable and Consistent Membership at Scale with Rapid][rapid]
//! * [Fast Paxos][fpx]
//!
//! [rapid]: https://arxiv.org/abs/1803.03620
//! [fpx]: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2005-112.pdf
//! [SWIM]: https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf
#![feature(entry_insert)]
#![warn(rust_2018_idioms, missing_docs)]
#![doc(
    issue_tracker_base_url = "https://github.com/nytopop/blip/issues/",
    html_logo_url = "https://raw.githubusercontent.com/nytopop/blip/master/blip.png",
    html_root_url = "https://docs.rs/blip/0.1.0-alpha.5",
    test(no_crate_inject, attr(deny(rust_2018_idioms)))
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[macro_use]
mod macros;

mod collections;

pub mod cluster;
pub mod overlay;
#[cfg(feature = "simulation")]
#[cfg_attr(docsrs, doc(cfg(feature = "simulation")))]
pub mod simulation;

#[doc(inline)]
pub use cluster::{
    cut::{Member, MultiNodeCut, Subscription},
    partition::Rejoin,
};
#[doc(inline)]
pub use overlay::{Mesh, MeshService};

/// A re-export of [async_trait][async_trait::async_trait] for convenience.
///
/// [async_trait]: https://docs.rs/async-trait/latest/async_trait/attr.async_trait.html
#[doc(inline)]
pub use tonic::async_trait;