From e63d30c2581033a85489b10c3f5b252fdbb5049e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 29 Nov 2026 03:21:43 +0000 Subject: state: plain writes take a view to write, Automerge's are asked for as such AppState::mutate_doc, mutate_doc_registering and mutate_doc_by hand what they are given a document::view::Write: the member registry, the users, sessions, forgetting and bootstrap write through them, and take whatever kind of document gives it. AppState::mutate_doc_for is for what asks more of an Automerge document than values at paths (the store's API, a remake's host, a store's events), and gives the heads after the write. What reads a view takes one of any size (dyn Write among them). --- src/access/envelope.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/access/envelope.rs') diff --git a/src/access/envelope.rs b/src/access/envelope.rs index d592bff..95371d3 100644 --- a/src/access/envelope.rs +++ b/src/access/envelope.rs @@ -39,7 +39,7 @@ pub(crate) fn listed_at() -> Vec { /// The paths `doc` lists as user-signed; an entry that isn't a list of strings is left /// out. -pub(crate) fn listed(doc: &impl Read) -> Vec> { +pub(crate) fn listed(doc: &(impl Read + ?Sized)) -> Vec> { let Ok(Some(JsonValue::Array(entries))) = view::read_plain(doc, &listed_at()) else { return Vec::new(); }; @@ -67,7 +67,7 @@ fn deciding() -> Vec> { /// The paths whose values their users sign under a strict policy: what decides who may /// do what (`deciding`), and those `doc` lists (`listed`). -pub(crate) fn signed_paths(doc: &impl Read) -> Vec> { +pub(crate) fn signed_paths(doc: &(impl Read + ?Sized)) -> Vec> { let mut paths = deciding(); paths.extend(listed(doc)); paths @@ -151,7 +151,7 @@ pub(crate) fn read(envelope: &str) -> Result { /// its swarm, that path, naming what it replaces and numbered after it, signed by one of /// its user's keys, a user who may write there. pub(crate) fn check( - doc: &impl Read, + doc: &(impl Read + ?Sized), envelope: &str, path: &[String], previous: Option<&str>, @@ -207,7 +207,7 @@ pub(crate) fn check( /// with only its keys changed from the one at `path` in `doc`, one left at least: a user /// manages its own keys, whatever else it may do. fn own_keys_only( - doc: &impl Read, + doc: &(impl Read + ?Sized), payload: &Payload, user: ®istry::User, path: &[String], -- cgit v1.3.1