Crates.io | cold-io |
lib.rs | cold-io |
version | 0.2.0 |
source | src |
created_at | 2021-08-24 08:13:03.436372 |
updated_at | 2021-08-26 12:56:46.423135 |
description | Event driven network io |
homepage | |
repository | https://github.com/vlad9486/cold-io |
max_upload_size | |
id | 441579 |
size | 48,256 |
It is the wrapper over mio
. Allows to write a network application as a state machine to simplify testing.
The core entity is Proposer
it working with the state machine that user implemented.
The Proposer
provides the state machine a sequence of Proposal
. For each Proposal
state machine can return some Request
.
It containing random number generator, elapsed time from previous proposal and one of the following messages:
Proposer
sends to the state machine. It needed for the state machine to provide a first request.The state machine receive ReadOnce
object along with OnReadable
event. The state machine can read it, or drop, or store for further use. The proposer will not send another ReadOnce
until previous did not consumed. It can be dropped and the connection part (read or write) will be closed. If the state machine read the object, it will know how many bytes was read, and whether there will be more.
The state machine receive WriteOnce
object along with OnWritable
event. It is very similar to ReadOnce
.
There are following elemental requests: