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/peer/forget.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/swarm/peer/forget.rs') diff --git a/src/swarm/peer/forget.rs b/src/swarm/peer/forget.rs index a1676b5..8616ae9 100644 --- a/src/swarm/peer/forget.rs +++ b/src/swarm/peer/forget.rs @@ -11,7 +11,8 @@ use tracing::{info, warn}; use crate::document::Document; use crate::document::meta; -use crate::document::store::{self, StoreError}; +use crate::document::store::StoreError; +use crate::document::view; use crate::state::{AppState, Standing}; fn forgotten_dir() -> Vec { @@ -32,7 +33,7 @@ pub(crate) fn affects_forget_records(path: &[String]) -> bool { } fn forgotten_peers(doc: &Document) -> Vec { - store::keys_at(doc, &forgotten_dir()) + view::keys_at(doc, &forgotten_dir()) .ok() .flatten() .unwrap_or_default() @@ -56,7 +57,7 @@ pub(super) async fn apply_forget_records(state: &AppState, applied: &mut Applied forgotten_peers(&replica.doc) .into_iter() .filter_map(|pk| { - let record = store::read_path(&replica.doc, &forgotten_path(&pk)).ok()??; + let record = view::read_path(&replica.doc, &forgotten_path(&pk)).ok()??; Some((pk, record)) }) .collect() @@ -99,7 +100,7 @@ pub(super) async fn apply_forget_records(state: &AppState, applied: &mut Applied let local_id = state.local_id().to_owned(); let _ = state .mutate_doc(move |doc| { - match store::delete_path(&mut *doc, &forgotten_path(&local_id), false) { + match view::delete_path(&mut *doc, &forgotten_path(&local_id), false) { Ok(()) => { info!("We were forgotten swarm-wide but are alive; cancelling the record") } -- cgit v1.3.1