Skip to main content

Module peer

Module peer 

Source
Expand description

Cluster peer state.

A Peer is the in-memory record for one dynomite node in the ring. Each peer carries its endpoint, rack, datacenter, token list, liveness state, and a handle to the outbound connection pool used when the dispatcher routes a request to it.

The data shape mirrors the reference engine’s per-peer node record (rack, dc, secure flag, same-DC flag, token list, state). Peers are held by crate::cluster::ServerPool in an Arc<RwLock<_>> so gossip and dispatch can both observe the table without taking out exclusive locks for read.

§Examples

use dynomite::cluster::peer::{Peer, PeerEndpoint, PeerState};
use dynomite::hashkit::DynToken;

let p = Peer::new(
    0,
    PeerEndpoint::tcp("127.0.0.1".into(), 8101),
    "rack1".into(),
    "dc1".into(),
    vec![DynToken::from_u32(101_134_286)],
    true,
    true,
    false,
);
assert_eq!(p.rack(), "rack1");
assert_eq!(p.state(), PeerState::Joining);

Structs§

Peer
One peer in the cluster ring.
PeerEndpoint
Network endpoint of a peer.

Enums§

PeerState
Lifecycle state of a peer in the gossip view.