reifydb_runtime/context/
mod.rs1pub mod clock;
5pub mod rng;
6
7use clock::{Clock, MockClock};
8use rng::Rng;
9
10#[derive(Clone)]
12pub struct RuntimeContext {
13 pub clock: Clock,
14 pub rng: Rng,
15}
16
17impl RuntimeContext {
18 pub fn new(clock: Clock, rng: Rng) -> Self {
20 Self {
21 clock,
22 rng,
23 }
24 }
25
26 pub fn with_clock(clock: Clock) -> Self {
28 Self {
29 clock,
30 rng: Rng::default(),
31 }
32 }
33
34 pub fn testing(initial_millis: u64, seed: u64) -> Self {
36 Self {
37 clock: Clock::Mock(MockClock::from_millis(initial_millis)),
38 rng: Rng::seeded(seed),
39 }
40 }
41}