Module puffin::stream

source ·
Expand description

The communication streams between Agents.

These are currently implemented by using an in-memory buffer. One might ask why we want two channels. There two very practical reasons for this. Note that these are advantages for the implementation and are not strictly required from a theoretical point of view.

  • Having two buffers resembles how networking works in reality: Each computer has an input and an output buffer. In case of TCP the input buffer can become full and therefore the transmission is throttled.
  • It is beneficial to model each agent with two buffers according to the Single-responsibility principle. When sending or receiving data each agent only has to look at its own two buffer. If each agent had only one buffer, then you would need to read from another agent which has the data you want. Or if you design it the other way around you would need to write to the buffer of the agent to which you want to send data.

The Agent Alice can add data to the inbound channel of Bob. Bob can then read the data from his inbound channel and put data in his outbound channel. If Bob is an Agent, which has an underlying PUT state then OpenSSL may write into the outbound channel of Bob.

Structs§

Traits§

Type Aliases§