diff options
| author | tv <tv@krebsco.de> | 2026-10-24 21:27:01 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-24 21:27:01 +0200 |
| commit | 6d128ad96ef165eb9781677b2659fcdfcfdee0b2 (patch) | |
| tree | ffa7edaf38e082580838b067217b2077afe289e0 /src/remake/local.rs | |
| parent | 7adda3354362ffd3396ee5ea9e84fa521c5e6d0c (diff) | |
add votes register
Diffstat (limited to 'src/remake/local.rs')
| -rw-r--r-- | src/remake/local.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/remake/local.rs b/src/remake/local.rs index ec2f70a..0d6c6c7 100644 --- a/src/remake/local.rs +++ b/src/remake/local.rs @@ -17,12 +17,23 @@ use super::records::{Retention, unix_millis}; use super::snapshot::Snapshot; use crate::document::replica::Epoch; -#[derive(Default)] pub(crate) struct RemakeState { + /// When this node started (Unix milliseconds): votes it cast before may be lost + /// (`vote`). + started_at: u64, // A std mutex: every access is short and never spans an await. inner: Mutex<Inner>, } +impl Default for RemakeState { + fn default() -> Self { + Self { + started_at: unix_millis(), + inner: Mutex::default(), + } + } +} + #[derive(Default)] struct Inner { /// Built by the coordinator at commit time; consumed by the local switch. @@ -130,6 +141,10 @@ pub(crate) struct ArchivedEpoch { } impl RemakeState { + pub(crate) fn started_at(&self) -> u64 { + self.started_at + } + fn lock(&self) -> MutexGuard<'_, Inner> { self.inner .lock() |
