Skip to main content

WorkerExchange

Struct WorkerExchange 

Source
pub struct WorkerExchange {
    pub handle: Handle,
    pub senders: HashMap<WorkerId, LinkSender>,
    pub receivers: Vec<LinkReceiver>,
}
Expand description

This worker’s exchange endpoints for a multi-process run: one LinkSender per peer worker it sends to, and one LinkReceiver per peer it receives from (established by the membership handshake before start). Graph::start runs with none of this — a single-worker run where every edge is a local SyncSender; the multi-process path is Graph::start_worker, which derives the actual edge wiring from the placement.

The mechanism is identical either way — an out-edge is a bounded SyncSender, drained by the dest task (local) or by an OutboundBridge (remote); an InboundBridge delivers a decoded (edge, msg) into the local dest inbox exactly as a local outlet would. Edge ids agree across workers because every worker builds the same graph in the same order, so the edge on the wire names the same logical edge — and thus the same dest task — on both ends.

Fields§

§handle: Handle

The tokio runtime the bridges drive (block_on). Must be multi-threaded: its workers run the links’ socket tasks while the bridge threads block on them.

§senders: HashMap<WorkerId, LinkSender>

A link to each peer worker this worker sends edges to, keyed by that worker’s id.

§receivers: Vec<LinkReceiver>

A link from each peer this worker receives edges from; each delivers its frames as (edge, msg) into local inboxes, routed by the edge’s target task.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.