dynomite/cluster/mod.rs
1//! Cluster layer: pools, peers, datacenters, racks, gossip,
2//! snitch, vnode dispatch, and the cluster-aware
3//! [`Dispatcher`](crate::net::Dispatcher) implementation.
4//!
5//! This module owns the cluster-wide data structures (the server
6//! pool plus the peer/dc/rack arrays). It is the seam between the
7//! per-connection state machines from [`crate::net`] (which only
8//! know about a single peer) and the routing logic that decides
9//! which peers receive a given request.
10//!
11//! Public surface:
12//!
13//! * [`peer::Peer`] / [`peer::PeerState`] - per-peer record.
14//! * [`datacenter::Datacenter`] / [`datacenter::Rack`] - topology.
15//! * [`vnode::dispatch`] - token ring lookup.
16//! * [`snitch`] - rack-distance helpers.
17//! * [`pool::ServerPool`] - cluster-wide owner.
18//! * [`gossip::GossipState`] / [`gossip::GossipConfig`] - gossip
19//! bookkeeping.
20//! * [`dispatch::ClusterDispatcher`] - the
21//! [`crate::net::Dispatcher`] implementation that replaces
22//! [`crate::net::NoopDispatcher`] for production wiring.
23//!
24//! # Examples
25//!
26//! ```
27//! use dynomite::cluster::peer::{Peer, PeerEndpoint};
28//! use dynomite::hashkit::DynToken;
29//! let p = Peer::new(
30//! 0,
31//! PeerEndpoint::tcp("127.0.0.1".into(), 8101),
32//! "rack1".into(),
33//! "dc1".into(),
34//! vec![DynToken::from_u32(1)],
35//! true,
36//! true,
37//! false,
38//! );
39//! assert_eq!(p.dc(), "dc1");
40//! ```
41
42pub mod admin_rpc;
43pub mod apl;
44pub mod capability;
45pub mod coverage;
46pub mod datacenter;
47pub mod dispatch;
48pub mod failure_detector;
49pub mod gossip;
50pub mod hints;
51pub mod peer;
52pub mod pool;
53pub mod snitch;
54pub mod swim;
55pub mod vnode;
56
57pub use self::admin_rpc::{
58 ClusterAdmin, ClusterChange, ClusterChangeKind, ClusterError, JoinPlan, NoopClusterAdmin,
59 PeerSnapshot, PeerSpec, PoolClusterAdmin,
60};
61pub use self::apl::{get_apl_ann, AnnotatedPeer, NodeRole};
62
63pub use self::datacenter::{Continuum, Datacenter, Rack};
64pub use self::dispatch::{map_hash, ClusterDispatcher, DispatchPlan, ReplicaTarget};
65pub use self::gossip::{
66 parse_seed_node, GossipConfig, GossipHandler, GossipNode, GossipState, GossipStep, SeedRecord,
67};
68pub use self::hints::{Hint, HintStore, HintStoreError, HintStoreOpenError, HintStoreStats};
69pub use self::peer::{Peer, PeerEndpoint, PeerState};
70pub use self::pool::{PoolConfig, ServerPool};
71pub use self::snitch::{rack_distance, RackDistance};
72pub use self::swim::{
73 Incarnation, Member, ProbeResult, Status, SwimConfig, SwimHandler, SwimState, Tick, Update,
74};
75pub use self::vnode::{dispatch as vnode_dispatch, rebuild_continuums, PeerTokens};