aboutsummaryrefslogtreecommitdiffstats
path: root/src/remake/switch.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/switch.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/switch.rs')
-rw-r--r--src/remake/switch.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/remake/switch.rs b/src/remake/switch.rs
index 1a4dbf9..9cc1ca0 100644
--- a/src/remake/switch.rs
+++ b/src/remake/switch.rs
@@ -32,7 +32,7 @@ use super::delta::{self, ReplayStats};
use super::kind::Translator;
use super::local::LocalStatus;
use super::quarantine;
-use super::records::{self, EpochRecord, Record, unix_millis};
+use super::records::{self, EpochRecord, Record};
use super::snapshot::{self, META_ROOT, REMAKES};
use super::vote;
use crate::document::replica::Epoch;
@@ -73,7 +73,8 @@ pub(crate) async fn run_worker<H: Host>(host: H) {
async fn check<H: Host>(host: &H) {
let local = host.current_epoch();
- host.remake().prune_archive(local.generation);
+ host.remake()
+ .prune_archive(local.generation, host.now_millis());
// While rejoining, the document is being filled from peers: its records are not
// complete enough to act on.
@@ -87,7 +88,7 @@ async fn check<H: Host>(host: &H) {
content::prune(
host,
&all,
- unix_millis(),
+ host.now_millis(),
host.dormant_after().as_millis() as u64,
);
let local_record = EpochRecord::from(local);
@@ -144,7 +145,7 @@ async fn check<H: Host>(host: &H) {
host.remake().set_status(
&id,
LocalStatus {
- switched_at: Some(unix_millis()),
+ switched_at: Some(host.now_millis()),
replayed_paths: Some(stats.replayed),
failed_paths: Some(stats.failed),
quarantine,
@@ -257,8 +258,13 @@ async fn switch<H: Host>(
&old,
std::mem::take(&mut stats.quarantined),
);
- host.remake()
- .archive(previous, old, retention, expected.generation);
+ host.remake().archive(
+ previous,
+ old,
+ retention,
+ expected.generation,
+ host.now_millis(),
+ );
info!(
remake = %id,