umi_memory/dst/mod.rs
1//! DST - Deterministic Simulation Testing
2//!
3//! TigerBeetle/FoundationDB-style deterministic simulation testing framework.
4//!
5//! # Philosophy
6//!
7//! > "If you're not testing with fault injection, you're not testing."
8//!
9//! # Usage
10//!
11//! ```rust
12//! use umi_memory::dst::{Simulation, SimConfig, FaultConfig, FaultType};
13//!
14//! #[tokio::test]
15//! async fn test_storage_survives_faults() {
16//! let sim = Simulation::new(SimConfig::with_seed(42))
17//! .with_fault(FaultConfig::new(FaultType::StorageWriteFail, 0.1));
18//!
19//! sim.run(|env| async move {
20//! env.storage.write("key", b"value").await?;
21//! env.clock.advance_ms(1000);
22//! let result = env.storage.read("key").await?;
23//! assert_eq!(result, Some(b"value".to_vec()));
24//! Ok(())
25//! }).await.unwrap();
26//! }
27//! ```
28//!
29//! Run with explicit seed for reproducibility:
30//! ```bash
31//! DST_SEED=12345 cargo test
32//! ```
33
34mod clock;
35mod config;
36mod fault;
37mod llm;
38mod network;
39mod property;
40mod rng;
41mod simulation;
42mod storage;
43
44pub use clock::SimClock;
45pub use config::SimConfig;
46pub use fault::{FaultConfig, FaultInjector, FaultInjectorBuilder, FaultType};
47pub use llm::{LLMError, SimLLM};
48pub use network::{NetworkError, NetworkMessage, SimNetwork};
49pub use property::{
50 run_property_tests, test_seeds, PropertyTest, PropertyTestFailure, PropertyTestResult,
51 PropertyTestable, TimeAdvanceConfig,
52};
53pub use rng::DeterministicRng;
54pub use simulation::{create_simulation, SimEnvironment, Simulation};
55pub use storage::{SimStorage, StorageError, StorageReadError, StorageWriteError};