Expand description
How nodes reach each other.
A Backend is the network a cluster runs on. It is deliberately small:
it connects to and accepts connections from other nodes, and a connection
offers ordered, reliable, bidirectional streams and unreliable datagrams.
Everything else is done for it by the cluster, the same for every backend:
keeping one connection per peer, reconnecting with backoff, telling
unreachable from down, ordering and framing messages, and routing them to
the layer they are for.
A cluster runs over any implementation of Backend, Endpoint and
Connection, handed to ClusterConfig::new in zestors-distr. The QUIC
backend is in the zestors-distr-quic crate.
§What a backend must provide
- Verified identity.
Connection::peeris the node on the other end, established by the backend and not taken from the peer’s word: from a certificate, a key, or credentials.Endpoint::connectreaches the node with the given name at the given address, and fails if it isn’t that node;Endpoint::acceptderives the name of whoever connected. The cluster trusts it completely, since without it any node could impersonate another. - Streams. Bytes written to a stream arrive complete and in order, or not at all once the connection is lost. Streams are independent: a stall on one must not hold up the others, which is what a backend with native streams gets for free, and one without has to arrange.
- Datagrams, if it has them. A backend without returns
DatagramError::Unsupported, and the cluster uses streams instead.
Structs§
- Node
Addr - Where a node can be reached, in terms its backend understands.
- Node
Incarnation - The node a
Backendis started for. - Node
Name - The name of a node in a distributed system.
Enums§
- Datagram
Error - Why a datagram couldn’t be sent.
Traits§
- Backend
- A way of connecting nodes, see the module docs.
- Connection
- A connection to one peer.
- Endpoint
- A node’s presence on the network: it connects to peers and accepts theirs.
Type Aliases§
- Recv
Stream - The receiving half of a stream. Reads to the end once the peer has shut down its half.
- Send
Stream - The sending half of a stream. Shutting it down ends the stream, after everything written to it has been sent.