pub struct InterCoreTransport { /* private fields */ }Expand description
Cross-core routing transport backed by InterCoreQueue ring buffers.
When the destination actor lives on a different core, the message is pushed
to rings[my_core][dest_core] instead of being delivered directly. The
receiving core’s event loop is responsible for draining its inbound rings.
Falls back to the local InProcessTransport when the destination is on
the same core or has no placement entry.
After each successful cross-core push the sender signals the destination
core’s entry in the shared has_work flag array (cache-line padded to
prevent false sharing). The drain task on the destination core uses this
flag to break out of its spin window early and to skip the expensive
yield_now() / Tokio wakeup when more inter-core work is already in flight.
Implementations§
Source§impl InterCoreTransport
impl InterCoreTransport
Sourcepub fn new(
my_core: usize,
num_cores: usize,
capacity: usize,
placement: Arc<PlacementMap>,
local: Arc<InProcessTransport>,
) -> Self
pub fn new( my_core: usize, num_cores: usize, capacity: usize, placement: Arc<PlacementMap>, local: Arc<InProcessTransport>, ) -> Self
Create a new InterCoreTransport owning an N×N ring buffer matrix and
a private has_work flag array.
capacity is the number of messages each ring can hold before
returning TransportError::MailboxFull.
When multiple transport instances need to share the same flag array
(i.e. cross-core signalling in MultiCoreEngine), construct the struct
directly using the public fields rather than calling this constructor.
Sourcepub fn try_deliver(
&self,
envelope: Envelope,
payload: MessagePayload,
) -> Result<(), TransportError>
pub fn try_deliver( &self, envelope: Envelope, payload: MessagePayload, ) -> Result<(), TransportError>
Deliver a message, routing cross-core via the ring buffer if needed.
Trait Implementations§
Source§impl Transport for InterCoreTransport
impl Transport for InterCoreTransport
Source§fn try_send(
&self,
envelope: Envelope,
payload: MessagePayload,
) -> Result<(), TransportError>
fn try_send( &self, envelope: Envelope, payload: MessagePayload, ) -> Result<(), TransportError>
MailboxFull if the
transport’s outbound buffer is full.