Expand description
MockRuntime (feature runtime-mock): virtual time and an in-memory network, so that
driven connections run deterministically and a 30-second timeout takes no wall time.
- Clock.
MockRuntime::nowstarts at the moment the runtime was made and moves only when told:MockClock::advanceby hand, or, insideMockRuntime::run(andblock_on), to the next timer whenever nothing can run (as tokio’s paused clock does). A timer whose time is reached is woken; what waits on nothing with no timer pending is a deadlock, andrunpanics saying so instead of hanging. - Executor. Tasks run on the thread that calls
run, in the order they were woken. - Network (
MockNet). UDP sockets (multicast included) and TCP listeners and connections between mock sockets, by address: no file descriptor, nothing leaves the process. Each direction between two IP addresses is a link with a delay, a loss rate and a block switch (LinkConfig); loss draws from a seeded generator, so a run is the same every time. A filter can drop chosen datagrams (MockNet::set_filter), and every datagram is logged with its traffic class and fate (MockNet::log). Names resolve from a table (MockNet::add_host). TCP is reliable: its bytes take the link’s delay, never its loss, and a blocked link holds a connection attempt forever.
Structs§
- Datagram
Record - One datagram of the
MockNet::log. - Link
Config - One direction between two IP addresses of the
MockNet. - Mock
Clock - The virtual clock of a
MockRuntime. - Mock
Datagram - A datagram as the
MockNetsees it, for a filter. - MockNet
- The in-memory network of a
MockRuntime. - Mock
Runtime - A runtime on virtual time with an in-memory network (see the module documentation).
Enums§
- Fate
- What became of a datagram.
Type Aliases§
- Datagram
Filter - A filter of the
MockNet:falsedrops the datagram.