diff options
| author | tv <tv@krebsco.de> | 2026-11-29 03:15:05 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-29 03:15:05 +0000 |
| commit | 9188fa6e13ea7facfab5fb6f55bf26444ec2c01e (patch) | |
| tree | 28b33908d0519bd21b03ee18bb34126c484ec0bb /src/swarm/peer/forget.rs | |
| parent | c396d33a34ee6685e9a561baa4d3ae4956b697be (diff) | |
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.
Diffstat (limited to 'src/swarm/peer/forget.rs')
| -rw-r--r-- | src/swarm/peer/forget.rs | 9 |
1 files changed, 5 insertions, 4 deletions
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<String> { @@ -32,7 +33,7 @@ pub(crate) fn affects_forget_records(path: &[String]) -> bool { } fn forgotten_peers(doc: &Document) -> Vec<String> { - 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") } |
