From 9188fa6e13ea7facfab5fb6f55bf26444ec2c01e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 29 Nov 2026 03:15:05 +0000 Subject: document: values read and written through a view any kind of document gives document::view: Read (the value at a path, plain, typed, a map's keys) and Write (a value written, one deleted), which Automerge's documents, writes in progress and documents as they were all are. The member registry, the users, access control's reads and rules, the topology, forgetting and bootstrap read and write through them, and name neither Automerge's ReadDoc and Transactable nor document::store, which is what an Automerge document can do beyond. How a swarm holding a store judges what a change writes is handed to the rules (rules::judge_seen), being its kind of document's to say. --- src/swarm/topology/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/swarm/topology') diff --git a/src/swarm/topology/mod.rs b/src/swarm/topology/mod.rs index f2538cc..df9a27e 100644 --- a/src/swarm/topology/mod.rs +++ b/src/swarm/topology/mod.rs @@ -161,7 +161,7 @@ pub(crate) fn swarm_ways( what: &str, own: T, ) -> T { - match crate::document::store::read_path(doc, path) { + match crate::document::view::read_path(doc, path) { Ok(Some(value)) => match serde_json::from_value(value.clone()) { Ok(recorded) => recorded, Err(_) => { @@ -686,7 +686,7 @@ pub(crate) fn neighbours_path() -> Vec { /// document has none (a swarm from before it was recorded), or one that isn't a number /// from 2 to `MAX_NEIGHBOURS`, this node's own (`own`). pub(crate) fn swarm_neighbours(doc: &crate::document::Document, own: usize) -> usize { - match crate::document::store::read_path(doc, &neighbours_path()) { + match crate::document::view::read_path(doc, &neighbours_path()) { Ok(Some(value)) => match value.as_u64() { Some(k) if (2..=MAX_NEIGHBOURS).contains(&k) => k as usize, _ => { -- cgit v1.3.1