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/bootstrap.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/swarm/bootstrap.rs') diff --git a/src/swarm/bootstrap.rs b/src/swarm/bootstrap.rs index 53b4af8..27b5e6b 100644 --- a/src/swarm/bootstrap.rs +++ b/src/swarm/bootstrap.rs @@ -26,7 +26,7 @@ use uuid::Uuid; use crate::document; use crate::document::meta::{self, SWARM}; use crate::document::replica::Epoch; -use crate::document::store; +use crate::document::view; use crate::document::{ActorId, Document}; use crate::files::{FileKind, Files}; use crate::force::Force; @@ -115,19 +115,19 @@ pub(crate) async fn bootstrap(state: &AppState, seeds: &[String], start: Start) state .mutate_doc(move |doc| { for (path, entry) in &users { - store::write_path(doc, path, entry)?; + view::write_path(doc, path, entry)?; } if let Some(policy) = &policy { - store::write_path(doc, &crate::access::policy::path(), policy)?; + view::write_path(doc, &crate::access::policy::path(), policy)?; } - store::write_path(doc, &swarm_id_path(), &recorded)?; - store::write_path( + view::write_path(doc, &swarm_id_path(), &recorded)?; + view::write_path( doc, &crate::swarm::topology::neighbours_path(), &JsonValue::from(neighbours), )?; - store::write_path(doc, &crate::swarm::topology::topology_path(), &topology)?; - store::write_path( + view::write_path(doc, &crate::swarm::topology::topology_path(), &topology)?; + view::write_path( doc, &crate::swarm::topology::dissemination_path(), &dissemination, @@ -247,7 +247,7 @@ fn swarm_id_path() -> Vec { /// The swarm ID the document names, if any. fn read_swarm_id(doc: &Document) -> Option { - match store::read_path(doc, &swarm_id_path()) { + match view::read_path(doc, &swarm_id_path()) { Ok(Some(JsonValue::String(id))) if !id.is_empty() => Some(id), _ => None, } -- cgit v1.3.1