pub struct Node { /* private fields */ }Expand description
Builder that turns minimal config into a connected ProcessGroup.
Implementations§
Source§impl Node
impl Node
Sourcepub fn new(rank: u32, world: u32) -> Self
pub fn new(rank: u32, world: u32) -> Self
A node at rank of world, full-mesh, default heap. Set peers with
Self::peers or Self::discover before Self::connect.
Sourcepub fn discover_via(self, host: impl Into<String>) -> Self
pub fn discover_via(self, host: impl Into<String>) -> Self
Unicast the discovery query to host instead of broadcasting — for a
worker behind NAT (Docker/QEMU) that can’t hear the coordinator’s LAN
broadcast. It learns the coordinator’s port from the reply and dials
host:port. Only used with a discovering Topology::Star worker.
Sourcepub fn peers<A: ToSocketAddrs>(
self,
addrs: impl IntoIterator<Item = A>,
) -> Result<Self>
pub fn peers<A: ToSocketAddrs>( self, addrs: impl IntoIterator<Item = A>, ) -> Result<Self>
Static peer addresses, one per rank (mesh) or just the coordinator
(star, peers[0]). Accepts anything ToSocketAddrs (host:port or ip:port).
Sourcepub fn discover(self, disc_port: u16, data_base: u16) -> Self
pub fn discover(self, disc_port: u16, data_base: u16) -> Self
Discover peers by UDP broadcast (zero-config on a shared LAN): each node
announces rank → ip:(data_base+rank) on disc_port until all world
addresses are known.
pub fn topology(self, t: Topology) -> Self
Sourcepub fn heap_bytes(self, n: usize) -> Self
pub fn heap_bytes(self, n: usize) -> Self
Per-rank symmetric-heap size in bytes (default DEFAULT_HEAP_BYTES).
pub fn rank(&self) -> u32
pub fn world(&self) -> u32
Sourcepub fn from_env() -> Result<Self, String>
pub fn from_env() -> Result<Self, String>
Read node config from the environment:
RANK, WORLD — this rank / total ranks
PEERS=host:port,host:port,… — static addresses, or
DISCOVER=1 (+ DISC_PORT/DATA_PORT) — UDP auto-discovery
TOPOLOGY=mesh|star (DIAL_OUT=1 = star)
HEAP_MB — per-rank heap (optional)
Sourcepub fn connect(self) -> Result<Arc<ProcessGroup>>
pub fn connect(self) -> Result<Arc<ProcessGroup>>
Establish the transport and return a ready ProcessGroup.