Commit Graph

3 Commits (b7c0bcb61f0753a9d6dcc517207783a206e57e79)

Author SHA1 Message Date
Dom Dwyer fc866ebe92
feat(gossip): peer exchange
This commit implements peer exchange (abbreviated PEX) between peers
of the gossip cluster.

This allows using a set of fixed seeds and dynamic node membership -
nodes can come and go without having to be manually configured across
all peers in order to communicate.

"Dead" peers are periodically cleaned from the local list of active
peers, ensuring the list of peers doesn't grow forever as node churn
occurs. This is a best-effort, conservative process, biasing towards
reliability/deliverability rather than accuracy and fast removal - it's
not a health check!
2023-07-25 15:14:19 +02:00
Dom Dwyer bc9ebc9c66
feat: gossip primitive
Adds a simple "gossip" implementation (more accurately described as a
pub/sub primitive currently) that supports broadcasting
application-level messages to the set of active peers.

This implementation uses UDP as a transport for best-effort delivery,
and enables zero-copy use of the payload using the Bytes crate.

Only peers explicitly provided as "seeds" when initialising will be
known to a gossip node - there's currently no peer exchange mechanism.
This implementation tolerates seeds changing their DNS entries when
restarting to point at new socket addresses (such as within Kubernetes
when pods move around).
2023-07-10 12:11:14 +02:00
Dom Dwyer 48aa4a5e33
feat(gossip): frame proto definitions
Adds a proto definition and configures prost to build the rust types
from it.

The gossip framing is intended to be flexible and decoupled - the gossip
library will batch together one or more opaque application messages
and/or control frames, and uniquely identify each peer with a
per-instance UUID to detect crashes/restarts and track peers.
2023-07-10 12:11:13 +02:00