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.
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more