diff options
| author | tv <tv@krebsco.de> | 2026-10-31 05:01:17 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 05:01:17 +0100 |
| commit | 6f9486a26b12828bcf553a6359673784c722ddcc (patch) | |
| tree | 34b3650d2fda697b4d75f0179bd5dece9fd4ec68 /src/document | |
| parent | 720a349d04a7a267461b21679ee2f748b8d8e957 (diff) | |
replace EpochInfo by EpochRecord
Diffstat (limited to 'src/document')
| -rw-r--r-- | src/document/replica.rs | 18 |
1 files changed, 18 insertions, 0 deletions
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<Epoch> 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 { |
