From 6f9486a26b12828bcf553a6359673784c722ddcc Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 05:01:17 +0100 Subject: replace EpochInfo by EpochRecord --- src/document/replica.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/document/replica.rs') diff --git a/src/document/replica.rs b/src/document/replica.rs index fe76c12..c8f648b 100644 --- a/src/document/replica.rs +++ b/src/document/replica.rs @@ -59,6 +59,24 @@ impl Epoch { } } +/// An epoch as records and the API show it: its generation and its snapshot hash in +/// hex (all zeros for the genesis epoch). +#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct EpochRecord { + pub(crate) generation: u64, + pub(crate) id: String, +} + +impl From for EpochRecord { + fn from(epoch: Epoch) -> Self { + Self { + generation: epoch.generation, + id: epoch.id_hex(), + } + } +} + impl fmt::Display for Epoch { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if *self == Epoch::GENESIS { -- cgit v1.3.1