Skip to main content

Node

Struct Node 

Source
pub struct Node { /* private fields */ }
Expand description

Builder that turns minimal config into a connected ProcessGroup.

Implementations§

Source§

impl Node

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub fn topology(self, t: Topology) -> Self

Source

pub fn heap_bytes(self, n: usize) -> Self

Per-rank symmetric-heap size in bytes (default DEFAULT_HEAP_BYTES).

Source

pub fn rank(&self) -> u32

Source

pub fn world(&self) -> u32

Source

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)

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.