aboutsummaryrefslogtreecommitdiffstats
path: root/src/access/envelope.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-29 03:21:43 +0000
committertv <tv@krebsco.de>2026-11-29 03:21:43 +0000
commite63d30c2581033a85489b10c3f5b252fdbb5049e (patch)
tree5f4e6f65f1cecfb32f841e7ad7d9d106aeb69b20 /src/access/envelope.rs
parent9188fa6e13ea7facfab5fb6f55bf26444ec2c01e (diff)
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).
Diffstat (limited to 'src/access/envelope.rs')
-rw-r--r--src/access/envelope.rs8
1 files changed, 4 insertions, 4 deletions
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<String> {
/// 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<Vec<String>> {
+pub(crate) fn listed(doc: &(impl Read + ?Sized)) -> Vec<Vec<String>> {
let Ok(Some(JsonValue::Array(entries))) = view::read_plain(doc, &listed_at()) else {
return Vec::new();
};
@@ -67,7 +67,7 @@ fn deciding() -> Vec<Vec<String>> {
/// 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<Vec<String>> {
+pub(crate) fn signed_paths(doc: &(impl Read + ?Sized)) -> Vec<Vec<String>> {
let mut paths = deciding();
paths.extend(listed(doc));
paths
@@ -151,7 +151,7 @@ pub(crate) fn read(envelope: &str) -> Result<Payload, String> {
/// 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: &registry::User,
path: &[String],