diff options
| author | tv <tv@krebsco.de> | 2026-10-26 05:38:41 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-26 05:38:41 +0100 |
| commit | f12a839d6e6bdd29a86ac52d5de836519a41aaf0 (patch) | |
| tree | b34da34a22292793c991b15a95908f6cd78bb70b /src/remake/snapshot.rs | |
| parent | 504435444c65efc59c0f7c6881991296258538a7 (diff) | |
wrap unix timestamps in newtype
Diffstat (limited to 'src/remake/snapshot.rs')
| -rw-r--r-- | src/remake/snapshot.rs | 15 |
1 files changed, 8 insertions, 7 deletions
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<ChangeHash>, pub(crate) policy: JsonValue, - pub(crate) proposed_at: u64, + pub(crate) proposed_at: UnixMillis, pub(crate) kind: String, pub(crate) content: Option<std::sync::Arc<Vec<u8>>>, 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<String, u64>, 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<String, u64>, 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, |
