pub struct NetTransport { /* private fields */ }Expand description
Full-mesh TCP transport implementing both Transport (two-sided
send/recv) and SymmetricTransport (one-sided put/get/barrier).
Construct via TcpTransport::bind or ThunderboltTransport::bind.
Implementations§
Source§impl NetTransport
impl NetTransport
Sourcepub fn from_listener(
rank: u32,
world: u32,
listener: TcpListener,
peers: Vec<SocketAddr>,
heap_size: usize,
) -> Result<NetTransport, Error>
pub fn from_listener( rank: u32, world: u32, listener: TcpListener, peers: Vec<SocketAddr>, heap_size: usize, ) -> Result<NetTransport, Error>
Build a transport from an already-bound listener. Ranks above us
we connect to; ranks below us we accept from (each connector
announces itself with a HELLO). peers[r] is rank r’s listen
address; peers[rank] must match listener.
Public so callers (and multi-rank tests) can pre-bind ephemeral
ports, exchange the addresses out-of-band, then construct the
mesh — avoiding the fixed-port races TcpTransport::bind is
subject to.
Trait Implementations§
Source§impl Drop for NetTransport
impl Drop for NetTransport
Source§impl SymmetricTransport for NetTransport
impl SymmetricTransport for NetTransport
Source§fn put(&self, buf: SymmetricBuffer, src: &[u8]) -> Result<(), CollectiveError>
fn put(&self, buf: SymmetricBuffer, src: &[u8]) -> Result<(), CollectiveError>
Write
src into buf. Errors on length mismatch.Source§fn get(
&self,
buf: SymmetricBuffer,
dst: &mut [u8],
) -> Result<(), CollectiveError>
fn get( &self, buf: SymmetricBuffer, dst: &mut [u8], ) -> Result<(), CollectiveError>
Read from
buf into dst. Errors on length mismatch.Source§impl Transport for NetTransport
impl Transport for NetTransport
Source§fn world_size(&self) -> u32
fn world_size(&self) -> u32
Total number of participating ranks.
Source§fn send_bytes(
&self,
to: u32,
tag: u32,
bytes: &[u8],
) -> Result<(), CollectiveError>
fn send_bytes( &self, to: u32, tag: u32, bytes: &[u8], ) -> Result<(), CollectiveError>
Send
bytes to rank to, tagged tag. Returns once the bytes
are handed to the transport (not necessarily delivered).Source§fn recv_bytes(&self, from: u32, tag: u32) -> Result<Vec<u8>, CollectiveError>
fn recv_bytes(&self, from: u32, tag: u32) -> Result<Vec<u8>, CollectiveError>
Block until a message with matching
(from, tag) arrives, and
return its payload.Auto Trait Implementations§
impl !Freeze for NetTransport
impl RefUnwindSafe for NetTransport
impl Send for NetTransport
impl Sync for NetTransport
impl Unpin for NetTransport
impl UnsafeUnpin for NetTransport
impl UnwindSafe for NetTransport
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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