From f12a839d6e6bdd29a86ac52d5de836519a41aaf0 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 26 Oct 2026 05:38:41 +0100 Subject: wrap unix timestamps in newtype --- src/remake/snapshot.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/remake/snapshot.rs') diff --git a/src/remake/snapshot.rs b/src/remake/snapshot.rs index 301b32f..d093a33 100644 --- a/src/remake/snapshot.rs +++ b/src/remake/snapshot.rs @@ -30,6 +30,7 @@ use sha2::{Digest, Sha256}; use super::kind::{DEFAULT_KIND, RemakeKind, Translator, by_name}; use super::records::{EpochRecord, Policy}; +use crate::clock::UnixMillis; use crate::document::meta::{self, EPOCHS, REMAKES, VOTES}; use crate::document::replica::Epoch; use crate::document::store::{self, StoreError}; @@ -44,8 +45,8 @@ pub(crate) struct SnapshotParams<'a> { pub(crate) base_heads: &'a [ChangeHash], /// Retention policy from the remake request; stored verbatim (canonicalized). pub(crate) policy: &'a JsonValue, - /// When the remake was proposed (unix ms); recorded for replay windows. - pub(crate) proposed_at: u64, + /// When the remake was proposed; recorded for replay windows. + pub(crate) proposed_at: UnixMillis, /// Name of the remake kind, which builds the user content. pub(crate) kind: &'a str, /// The kind's build input (the proposal's content). @@ -87,7 +88,7 @@ pub(crate) struct SnapshotRequest { pub(crate) previous: Epoch, pub(crate) base_heads: Vec, pub(crate) policy: JsonValue, - pub(crate) proposed_at: u64, + pub(crate) proposed_at: UnixMillis, pub(crate) kind: String, pub(crate) content: Option>>, pub(crate) translation: JsonValue, @@ -136,8 +137,8 @@ pub(crate) struct EpochMetadata { /// Highest sequence number per actor of `previous` contained in the snapshot. pub(crate) clock: BTreeMap, pub(crate) policy: Policy, - /// When the remake was proposed (unix ms): the point the swarm moved on. - pub(crate) proposed_at: u64, + /// When the remake was proposed: the point the swarm moved on. + pub(crate) proposed_at: UnixMillis, /// The remake kind and its translation input, for writes made before the epoch. pub(crate) kind: String, pub(crate) translation: JsonValue, @@ -163,7 +164,7 @@ struct MetadataRecord { clock: BTreeMap, policy: Policy, #[serde(default)] - proposed_at: u64, + proposed_at: UnixMillis, #[serde(default = "default_kind")] kind: String, #[serde(default)] @@ -393,7 +394,7 @@ mod tests { previous: Epoch::GENESIS, base_heads: heads, policy, - proposed_at: 0, + proposed_at: UnixMillis(0), kind: "compact", content: None, translation: &NULL, -- cgit v1.3.1