From 8626defcd2f6477fa22f12b18d012d3cd41d3c3d Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 05:23:23 +0100 Subject: remake: drop is_reserved; use is_protocol --- src/remake/kind.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/remake') diff --git a/src/remake/kind.rs b/src/remake/kind.rs index aa9e978..ca16de0 100644 --- a/src/remake/kind.rs +++ b/src/remake/kind.rs @@ -140,11 +140,6 @@ pub(crate) fn remake_genesis( Ok(()) } -/// Paths owned by the protocol rather than by any kind. -pub(crate) fn is_reserved(path: &[String]) -> bool { - meta::is_protocol(path) -} - /// Compaction: the new document has the old one's content at the base, without its /// history. Writes keep their paths. pub(crate) struct Compact; @@ -172,7 +167,7 @@ impl RemakeKind for Compact { _content: Option<&[u8]>, target: &mut AutoCommit, ) -> Result<(), StoreError> { - store::materialize_into(old_at_base, target, &is_reserved) + store::materialize_into(old_at_base, target, &meta::is_protocol) } fn translate(&self, _path: &[String], _translation: &JsonValue) -> Translation { @@ -311,7 +306,7 @@ fn prepare_rules(specs: Vec) -> Result { )); } }; - if is_reserved(&from) || to.as_deref().is_some_and(is_reserved) { + if meta::is_protocol(&from) || to.as_deref().is_some_and(meta::is_protocol) { return Err(format!( "rules must not touch the reserved key {:?}", meta::ROOT @@ -392,7 +387,7 @@ impl RemakeKind for Import { // and history. Usually much smaller than what was uploaded, and it is what every // voter downloads. let mut content = AutoCommit::new(); - store::materialize_into(&imported, &mut content, &is_reserved) + store::materialize_into(&imported, &mut content, &meta::is_protocol) .map_err(|error| format!("the document can't be read: {error}"))?; Ok(Prepared { @@ -410,7 +405,7 @@ impl RemakeKind for Import { let content = content.ok_or_else(|| anyhow::anyhow!("import without content"))?; let imported = AutoCommit::load(content)?; // Deterministic: the same bytes give the same view, copied in a fixed order. - store::materialize_into(&imported, target, &is_reserved) + store::materialize_into(&imported, target, &meta::is_protocol) } fn translate(&self, path: &[String], translation: &JsonValue) -> Translation { @@ -439,7 +434,7 @@ impl Translator { /// Where `path` ends up after all steps. Reserved paths always stay put. pub(crate) fn translate(&self, path: &[String]) -> Translation { - if is_reserved(path) { + if meta::is_protocol(path) { return Translation::Same; } let mut current = path.to_vec(); -- cgit v1.3.1