Skip to main content

Module turmoil

Module turmoil 

Source
Expand description

Consensus and Blob implementations suitable for use with turmoil.

Both implementations function by forwarding calls to a server backend via turmoil::net::TcpStreams. The server backend keeps a simple in-memory state (implemented using MemConsensus and MemBlob, respectively), which it uses to respond to RPCs.

In a turmoil test, both the consensus and the blob server should be run as separate hosts. This gives turmoil the ability to partition and crash them independently, for the maximum amount of interesting interleaving.

use mz_persist::turmoil::{BlobState, ConsensusState, serve_blob, serve_consensus};

let mut sim = turmoil::Builder::new().build();

sim.host("consensus", {
    let state = ConsensusState::new();
    move || serve_consensus(7000, state.clone())
});

sim.host("blob", {
    let state = BlobState::new();
    move || serve_blob(7000, state.clone())
});

To connect to these servers, use the following PersistLocation:

PersistLocation {
    blob_uri: "turmoil://blob:7000".parse().unwrap(),
    consensus_uri: "turmoil://consensus:7000".parse().unwrap(),
}

Structs§

BlobConfig
Configuration for a TurmoilBlob.
BlobState
State of a turmoil blob server.
ConsensusConfig
Configuration for a TurmoilConsensus.
ConsensusState
State of a turmoil consensus server.
TurmoilBlob
A Blob implementation for use in turmoil tests.
TurmoilConsensus
A Consensus implementation for use in turmoil tests.

Functions§

serve_blob
Run a turmoil blob server.
serve_consensus
Run a turmoil consensus server.