reifydb_runtime/context/
mod.rs1pub mod clock;
10pub mod rng;
11
12use clock::{Clock, MockClock};
13use rng::Rng;
14
15#[derive(Clone)]
16pub struct RuntimeContext {
17 pub clock: Clock,
18 pub rng: Rng,
19}
20
21impl RuntimeContext {
22 pub fn new(clock: Clock, rng: Rng) -> Self {
23 Self {
24 clock,
25 rng,
26 }
27 }
28
29 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 {
37 Self {
38 clock: Clock::Mock(MockClock::from_millis(initial_millis)),
39 rng: Rng::seeded(seed),
40 }
41 }
42}