March Docs

ClusterConn

ClusterConn: the net-kernel connection lifecycle (distributed P1, L2).

Ties the transport (NetKernel.handshake) to the peer table (PeerRegistry): dial out to a peer, or accept an inbound connection, run the authenticated handshake, and on success register the peer (one connection per NodeId). A handshake failure closes the socket and returns the reason.

Socket glue, runtime-exercised — the eval-based stdlib test harness does not run sockets (same convention as NetKernel/ChannelServer). It composes only already-unit-tested logic (NetKernel byte bridge + Handshake + ClusterAuth + PeerRegistry) over the available Socket.* / tcp_listen / tcp_accept APIs. (Type annotations are omitted so the qualified PeerRegistry.Registry/Peer type paths are resolved by inference against the bare definitions.)

Functions

fnaccept_oneaccept_one(reg, listen_fd, my_id, secret)#
fnconnect_to_peerconnect_to_peer(reg, host, port, my_id, secret)#
fnlistenlisten(port : Int) : Result(Int, String)#