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ยง
- Blob
Config - Configuration for a TurmoilBlob.
- Blob
State - State of a turmoil blob server.
- Consensus
Config - Configuration for a TurmoilConsensus.
- Consensus
State - State of a turmoil consensus server.
- Turmoil
Blob - A Blob implementation for use in turmoil tests.
- Turmoil
Consensus - A Consensus implementation for use in turmoil tests.
Enumsยง
- Blob
Command ๐ - Consensus
Command ๐ - RpcError ๐
- Serializable representation of
ExternalError.
Constantsยง
- RPC_
TIMEOUT ๐ - Timeout for RPC calls.
Functionsยง
- rpc_
read ๐ - Read an RPC message from the given connection.
- rpc_
write ๐ - Write an RPC message to the given connection.
- serve_
blob - Run a turmoil blob server.
- serve_
blob_ ๐connection - serve_
consensus - Run a turmoil consensus server.
- serve_
consensus_ ๐connection