aboutsummaryrefslogtreecommitdiffstats
path: root/src/remake/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-25 23:00:56 +0100
committertv <tv@krebsco.de>2026-10-25 23:00:56 +0100
commit05d1694622a7ef181dbbb4b9c0aeb2f8c07a5b48 (patch)
treec71b14e64257a700771c7af5ed0a86c0fb0f7cbd /src/remake/mod.rs
parenta76e50a0a97de28fd22a0c6c366b31f1b40859f8 (diff)
add clock module
The Clock module is the system clock that every unix timestamp new goes through. It comes with an offset that only tests can set.
Diffstat (limited to 'src/remake/mod.rs')
-rw-r--r--src/remake/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/remake/mod.rs b/src/remake/mod.rs
index 8908aee..705a830 100644
--- a/src/remake/mod.rs
+++ b/src/remake/mod.rs
@@ -58,6 +58,15 @@ pub(crate) trait Host: Clone + Send + Sync + 'static {
/// This node's in-memory remake state.
fn remake(&self) -> &RemakeState;
+ /// This node's wall clock (`clock`): deadlines, votes and decisions are stamped and
+ /// judged with it. Shared, so closures run under the document lock can read it.
+ fn clock(&self) -> Arc<crate::clock::Clock>;
+
+ /// Now, in Unix milliseconds, by [`clock`](Self::clock).
+ fn now_millis(&self) -> u64 {
+ self.clock().now_millis()
+ }
+
/// This node's ID (its peers know it by this).
fn node_id(&self) -> String;