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