aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/remake/kind.rs15
1 files changed, 5 insertions, 10 deletions
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<RuleSpec>) -> Result<JsonValue, String> {
));
}
};
- 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();