Expand description
Process-level runtime: actor system, thread pools, async executors, time and randomness, and the synchronisation
primitives the rest of the workspace builds on. The SharedRuntime handle carries the actor system, the pool set,
the clock, and the seeded RNG together so any subsystem that needs to spawn work, sleep, or generate ids gets a
consistent view of the world.
The crate abstracts platform differences: native targets get a tokio-backed pool, WebAssembly gets a single-task
executor, the deterministic-simulation target (reifydb_target = "dst") gets a virtual scheduler. All three sit
behind the same SharedRuntime API so callers do not branch on platform.
Invariant: SharedRuntime::seeded(...) is what produces a deterministic ReifyDB - same seed, same trace. Any
source of non-determinism inside the runtime (an unmocked clock, an unseeded RNG, a pool that schedules outside
the seeded executor) defeats DST replays and breaks the simulation harness.
Modules§
- actor
- Lightweight actor system. Each actor owns its mailbox, processes messages serially, and replies through a typed channel; the system handle spawns actors onto the runtime’s pools and supervises their lifecycle. Timers, testing fixtures, and reply patterns sit alongside so subsystem code can build on a consistent message-passing base without rolling its own concurrency primitives.
- cache
- context
- Sources of non-determinism the workspace consumes: the wall clock and the random number generator. Both have
mockable variants so a deterministic-simulation run replaces them with seeded equivalents and reproduces the
same trace bit-for-bit. Anything in the workspace that needs the time of day or a random value reaches for
these handles instead of pulling from
std. - pool
- Execution domains organized by workload shape. Long-lived actors run on the actor pool (two worker groups:
coordinationfor tiny high-frequency handlers,flowfor heavy flow execution) with per-worker run queues and pinned dispatch. Short-lived work (per-request actors, one-shot jobs) runs on the task pool. Data-parallel work runs on the compute pool (rayon behind an install-only API). Async I/O runs on the embedded tokio runtime. Native targets get the real pools; single-threaded and DST targets get the inline stub variant. ThePoolstype both impls hand back is whatSharedRuntimecarries around. - shutdown
- sync
- Synchronisation primitives that are mockable under deterministic simulation. The mutex, rwlock, condvar,
waiter, and concurrent map exposed here delegate to native equivalents on real targets and to a virtualised
scheduler on DST. Code that builds on
std::syncdirectly cannot be replayed; code that builds on this module can. - version_
epoch