aboutsummaryrefslogtreecommitdiffstats
path: root/src/remake
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
commitfb400722d672868dc71ba5a9913d2526d520848f (patch)
tree7ce85a15e73f4718561941d70f68725498547d3c /src/remake
parent204a38965c2c2e360ebdfeb357c6cfce50a3654d (diff)
remake: drop parse_metadata
Diffstat (limited to 'src/remake')
-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()])