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/rules.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/access/rules.rs') diff --git a/src/access/rules.rs b/src/access/rules.rs index 93cef63..d8831ce 100644 --- a/src/access/rules.rs +++ b/src/access/rules.rs @@ -219,7 +219,7 @@ pub(crate) fn judge_reading( /// In a swarm holding a store of some fold, as `holding` judges it there, which is its /// kind of document's to say. pub(crate) fn judge_seen( - at: &impl Read, + at: &(impl Read + ?Sized), epoch: Epoch, unit: &Unit<'_>, read: &mut Seen, @@ -502,7 +502,7 @@ pub(crate) fn judge_held( /// string put there that is one (or deleting what is there); nothing within one; nothing /// in an object nowhere to be found, which might be one. fn sealed_values( - at: &impl Read, + at: &(impl Read + ?Sized), declared: &[super::sealed::Declared], ops: &[Op], ) -> Result<(), String> { @@ -534,7 +534,7 @@ fn sealed_values( /// as a write replacing it does); nothing within one; above one, /// nothing replacing or deleting what holds one (a map made where there is none yet, /// what is inside a list or text, which holds none). -fn signed_values(at: &impl Read, ops: &[Op]) -> Result<(), String> { +fn signed_values(at: &(impl Read + ?Sized), ops: &[Op]) -> Result<(), String> { let signed = super::envelope::signed_paths(at); for op in ops { let path = &op.path; @@ -589,7 +589,7 @@ fn signed_values(at: &impl Read, ops: &[Op]) -> Result<(), String> { /// Whether what is at `path` in `at` holds a value at a place for one its user signs, /// of `signed` (`envelope::signed_paths`), signed or from before the policy; one that /// doesn't read, as if it did. -fn holds_signed(at: &impl Read, path: &[String], signed: &[Vec]) -> bool { +fn holds_signed(at: &(impl Read + ?Sized), path: &[String], signed: &[Vec]) -> bool { fn within(value: &serde_json::Value, place: &mut Vec, signed: &[Vec]) -> bool { if super::envelope::is_signed(signed, place) { return true; @@ -628,7 +628,12 @@ fn shown(path: &Path) -> String { /// Whether remake `id`, coordinated by `node`, made `epoch`: as its snapshot's metadata /// says (`remake::snapshot`), at `at`. Never genesis. -pub(super) fn made_the_epoch(at: &impl Read, epoch: Epoch, id: &str, node: &str) -> bool { +pub(super) fn made_the_epoch( + at: &(impl Read + ?Sized), + epoch: Epoch, + id: &str, + node: &str, +) -> bool { if epoch.generation == 0 { return false; } @@ -647,7 +652,7 @@ pub(super) fn made_the_epoch(at: &impl Read, epoch: Epoch, id: &str, node: &str) } /// The coordinator remake `id`'s proposal names, at `at`. -pub(super) fn coordinator(at: &impl Read, id: &str) -> Option { +pub(super) fn coordinator(at: &(impl Read + ?Sized), id: &str) -> Option { let proposal = view::read_path(at, &meta::path(&[meta::REMAKES, id, "proposal"])) .ok() .flatten()?; -- cgit v1.3.1