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 Default for RuntimeContext {
20 fn default() -> Self {
21 Self {
22 clock: Clock::default(),
23 rng: Rng::default(),
24 }
25 }
26}
27
28impl RuntimeContext {
29 pub fn new(clock: Clock, rng: Rng) -> Self {
31 Self {
32 clock,
33 rng,
34 }
35 }
36
37 pub fn with_clock(clock: Clock) -> Self {
39 Self {
40 clock,
41 rng: Rng::default(),
42 }
43 }
44
45 pub fn testing(initial_millis: u64, seed: u64) -> Self {
47 Self {
48 clock: Clock::Mock(MockClock::from_millis(initial_millis)),
49 rng: Rng::seeded(seed),
50 }
51 }
52}