pub struct Placement { /* private fields */ }Expand description
Where each node runs. The ones not listed run wherever they land.
Implementations§
Source§impl Placement
impl Placement
Sourcepub fn place(&mut self, id: impl Into<NodeId>, device: Device) -> Option<Device>
pub fn place(&mut self, id: impl Into<NodeId>, device: Device) -> Option<Device>
Places a node on a device, returning where it was before.
Sourcepub fn place_at(&mut self, id: impl Into<NodeId>, host: Host) -> Option<Host>
pub fn place_at(&mut self, id: impl Into<NodeId>, host: Host) -> Option<Host>
Sends a node to a host, returning which one it was on before.
Independent of place.
Sourcepub fn of(&self, id: &NodeId) -> Option<&Device>
pub fn of(&self, id: &NodeId) -> Option<&Device>
Which device this node runs on, if it was said. None is “wherever it
already is”, not cpu.
Sourcepub fn host_of(&self, id: &NodeId) -> Option<&Host>
pub fn host_of(&self, id: &NodeId) -> Option<&Host>
Which host this node runs on, if it was said. None is here.
Sourcepub fn hosts(&self) -> Vec<&Host>
pub fn hosts(&self) -> Vec<&Host>
Every host this placement names, once each, in a fixed order.
The half of host_of that reads the other way, for the
client that talks to a broker and so does not already know the names.
Once each, because a host named by ten nodes is one rendezvous. Sorted,
because these come out of a HashMap and an irreproducible order would
make the order failures happen in irreproducible too.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
How many nodes have something said about them: device, host or both.
Sourcepub fn is_local(&self) -> bool
pub fn is_local(&self) -> bool
Whether no node has been sent to any host, which is what allows skipping
distribute.