Function constructor

Source
pub async fn constructor(
    address: String,
    writer_rx: Receiver<TransactionMessage>,
    writer_tx: Sender<TransactionMessage>,
    connection_index: usize,
)
Expand description

Constructs a TCP connection.

§Notes

The writer_rx and writer_tx are passed into the constructor because the channel needs to be allocated by an allocator in order to get the connection_index.

The constructor spawns actors that must wait to recieve a message from another actor before they can emit a message, and actors that emit messages into the actor system. The actors that emit messages into the actor system are spawned with connection_id as an argument so they can start the message loop with an ID for tracing.

§Arguments

  • address: The address of the server the connection is being made to
  • writer_rx: The receiver for the writer actor
  • writer_tx: The sender for the writer actor
  • connection_index: The index of the connection in the allocator