aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 05:22:52 +0100
committertv <tv@krebsco.de>2026-10-31 05:22:52 +0100
commit751bcc1651063df8c274f6ba63fcbbc8d72ddb5c (patch)
treea01c5a9913811351f301654a65856f0bff87dc0e /src
parent27df21d3eadd6c28b7775e5b1a0a57e89b6b1d8b (diff)
remake: drop parse_metadata
Diffstat (limited to 'src')
-rw-r--r--src/remake/snapshot.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/remake/snapshot.rs b/src/remake/snapshot.rs
index b8c784e..b071b74 100644
--- a/src/remake/snapshot.rs
+++ b/src/remake/snapshot.rs
@@ -169,7 +169,13 @@ struct MetadataRecord {
translation: JsonValue,
}
-fn parse_metadata(doc: &AutoCommit, generation: u64) -> Result<EpochMetadata, String> {
+/// Metadata of an earlier generation, as the current document holds it. Snapshots
+/// carry the metadata of all earlier epochs forward (only remake records stay
+/// behind), so a node many epochs behind can still find the epoch that followed its own.
+pub(crate) fn read_epoch_metadata(
+ doc: &AutoCommit,
+ generation: u64,
+) -> Result<EpochMetadata, String> {
let value = store::read_path(doc, &epoch_metadata_path(generation))
.map_err(|error| error.to_string())?
.ok_or_else(|| format!("no epoch metadata for generation {generation}"))?;
@@ -215,7 +221,7 @@ pub(crate) fn verify_document(doc: &mut AutoCommit, epoch: Epoch) -> Result<Epoc
}
let at_snapshot = doc.fork_at(&[root]).map_err(|error| error.to_string())?;
- parse_metadata(&at_snapshot, epoch.generation)
+ read_epoch_metadata(&at_snapshot, epoch.generation)
}
/// The epoch `doc` is on: genesis if it holds no epoch metadata; otherwise the newest
@@ -250,16 +256,6 @@ pub(crate) fn epoch_of(doc: &mut AutoCommit) -> Result<Epoch, String> {
Ok(epoch)
}
-/// Metadata of an earlier generation, as the current document holds it. Snapshots
-/// carry the metadata of all earlier epochs forward (only remake records stay
-/// behind), so a node many epochs behind can still find the epoch that followed its own.
-pub(crate) fn read_epoch_metadata(
- doc: &AutoCommit,
- generation: u64,
-) -> Result<EpochMetadata, String> {
- parse_metadata(doc, generation)
-}
-
/// Path of the metadata record for an epoch generation.
pub(crate) fn epoch_metadata_path(generation: u64) -> Vec<String> {
meta::path(&[EPOCHS, generation.to_string().as_str()])