aboutsummaryrefslogtreecommitdiffstats
path: root/src/access/rules.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/rules.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/rules.rs')
-rw-r--r--src/access/rules.rs17
1 files changed, 11 insertions, 6 deletions
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<String>]) -> bool {
+fn holds_signed(at: &(impl Read + ?Sized), path: &[String], signed: &[Vec<String>]) -> bool {
fn within(value: &serde_json::Value, place: &mut Vec<String>, signed: &[Vec<String>]) -> 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<String> {
+pub(super) fn coordinator(at: &(impl Read + ?Sized), id: &str) -> Option<String> {
let proposal = view::read_path(at, &meta::path(&[meta::REMAKES, id, "proposal"]))
.ok()
.flatten()?;