[−][src]Enum d3_components::network::NetCmd
This is where d3 meets Tcp (Udp to follow). The Network leans heavily upon Mio to provide the foundation for interacting with the network. The d3 network provides an additional abstraction to adapt it for d3 machines and encapsulate Mio.
This sequence diagram illustrates a machine, Alice asking for a listener to be installed. When there is a connection, the network is told to send control and data commands to the machine Bob.
+-------+ +-----+ +-----+
| Alice | | Net | | Bob |
+-------+ +-----+ +-----+
| | |
| BindListner(addres, Alice:sender) | |
|--------------------------------------------------->| |
| -------------------------------\ | |
|-| Alice waits for a connection | | |
| |------------------------------| | |
| | |
| NewConn(conn_id, local, remote, write_buf_size) | |
|<---------------------------------------------------| |
| ----------------------------------\ | |
|-| Alice is told of the connection | | |
| | and has Bob handle it | | |
| |---------------------------------| | |
| BindConn(conn_id, Bob:sender) | |
|--------------------------------------------------->| |
| | ----------------------\ |
| | | Bob waits for bytes |-|
| | |---------------------| |
| | |
| | RecvBytes(conn_id, bytes) |
| |----------------------------->|
| | -----------------------\ |
| | | Bob sends some bytes |-|
| | |----------------------| |
| | |
| | SendBytes(conn_id, bytes) |
| |<-----------------------------|
| | ------------------------\ |
| | | Bob may be told how |-|
| | | much more he can send | |
| | |-----------------------| |
| | SendReady(write_buf_size) |
| |----------------------------->|
| |----------------------------\ |
| || Bob Closes the connection |-|
| ||---------------------------| |
| | |
| | Close(conn_id) |
| |<-----------------------------|
| | |
Variants
Stop the network. Stop is used in conjuntion with starting and stopping the Server and Network.
Binds a TCP listener to an address, notifying the sender when a connection is accepted.
New connection notification (connection_id, bind_addr, connect_from, max_byte) are sent to the sender regitered via the BindListener.
BindConn starts the flow of information (connection_id, sender) between the network and a sender.
CloseConn(NetConnId)
When sent to the network, CloseConn closes the connection, also known as a local close. When received by the BindConn listener, CloseConn is notification that the connection has been closed, also known as a remote close.
Sent to the BindConn sender, RecvBytes provides bytes read from the connection.
Sent to the network, SendBytes provides bytes to be written to the network.
Sent to the BindConn sender, it provides an update to the number of bytes availbe for writing to the network. A use case for this would be providing feedback for throttling data being generated for a connection.
Trait Implementations
impl Debug for NetCmd
[src]
impl MachineImpl for NetCmd
[src]
type Adapter = MachineBuilderNetCmd
type SenderAdapter = SenderAdapterNetCmd
type InstructionSet = NetCmd
fn park_sender(
channel_id: usize,
sender: Sender<Self::InstructionSet>,
instruction: Self::InstructionSet
) -> Result<(), Self::InstructionSet>
[src]
channel_id: usize,
sender: Sender<Self::InstructionSet>,
instruction: Self::InstructionSet
) -> Result<(), Self::InstructionSet>
Auto Trait Implementations
impl RefUnwindSafe for NetCmd
impl Send for NetCmd
impl Sync for NetCmd
impl Unpin for NetCmd
impl UnwindSafe for NetCmd
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
const ALIGN: usize
type Init = T
The type for initializers.
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,