aboutsummaryrefslogtreecommitdiffstats
path: root/src/simtest
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/simtest
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/simtest')
-rw-r--r--src/simtest/hyparview.rs4
-rw-r--r--src/simtest/mod.rs4
-rw-r--r--src/simtest/remakes.rs4
-rw-r--r--src/simtest/timing.rs4
4 files changed, 8 insertions, 8 deletions
diff --git a/src/simtest/hyparview.rs b/src/simtest/hyparview.rs
index 65d581c..b5177d1 100644
--- a/src/simtest/hyparview.rs
+++ b/src/simtest/hyparview.rs
@@ -218,12 +218,12 @@ async fn a_swarm_switches_to_hyparview_at_runtime() {
nodes[0]
.mutate_doc(|doc| {
- crate::document::store::write_path(
+ crate::document::view::write_path(
doc,
&crate::swarm::topology::topology_path(),
&json!("hyparview"),
)?;
- crate::document::store::write_path(
+ crate::document::view::write_path(
doc,
&crate::swarm::topology::dissemination_path(),
&json!("plumtree"),
diff --git a/src/simtest/mod.rs b/src/simtest/mod.rs
index d0f80da..d11a402 100644
--- a/src/simtest/mod.rs
+++ b/src/simtest/mod.rs
@@ -32,8 +32,8 @@ use serde_json::Value as JsonValue;
use tokio::time::Instant;
use crate::document::replica::Epoch;
-use crate::document::store;
use crate::document::{ChangeHash, Document};
+use crate::document::{store, view};
use crate::files::Files;
use crate::identity::NodeKey;
use crate::locks::{MutexExt, RwLockExt};
@@ -482,7 +482,7 @@ pub(crate) fn path(path: &str) -> Vec<String> {
/// Writes `value` at `path` (`a/b/c`) as one change, as the API does.
pub(crate) async fn write(node: &AppState, at: &str, value: JsonValue) {
let at = path(at);
- node.mutate_doc(move |doc| store::write_path(doc, &at, &value))
+ node.mutate_doc(move |doc| view::write_path(doc, &at, &value))
.await
.expect("write");
}
diff --git a/src/simtest/remakes.rs b/src/simtest/remakes.rs
index 6fa4235..49139b6 100644
--- a/src/simtest/remakes.rs
+++ b/src/simtest/remakes.rs
@@ -17,7 +17,7 @@ use serde_json::{Value as JsonValue, json};
use super::{SOON, Sim, read, write};
use crate::document::ChangeHash;
use crate::document::replica::Epoch;
-use crate::document::store;
+use crate::document::view;
use crate::remake::testing;
use crate::state::AppState;
use crate::swarm::bootstrap::Start;
@@ -257,7 +257,7 @@ async fn writes_through_a_rejoin_are_kept() {
while !stop.load(Ordering::Relaxed) {
let at = vec!["w".to_owned(), n.to_string()];
let written = c
- .mutate_doc(move |doc| store::write_path(doc, &at, &json!(n)))
+ .mutate_doc(move |doc| view::write_path(doc, &at, &json!(n)))
.await;
assert!(written.is_ok(), "write {n} refused: {written:?}");
answered.lock().unwrap().push(n);
diff --git a/src/simtest/timing.rs b/src/simtest/timing.rs
index 5f23c21..3f03562 100644
--- a/src/simtest/timing.rs
+++ b/src/simtest/timing.rs
@@ -404,7 +404,7 @@ async fn late_epoch_does_not_flip_a_peers_epoch() {
/// record itself.
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn forgotten_node_that_is_alive_cancels_its_record() {
- use crate::document::store;
+ use crate::document::{store, view};
use crate::swarm::peer::forgotten_path;
let sim = Sim::new(9);
@@ -416,7 +416,7 @@ async fn forgotten_node_that_is_alive_cancels_its_record() {
let record = forgotten_path(b.local_id());
let written = record.clone();
- a.mutate_doc(move |doc| store::write_path(doc, &written, &json!({"at": 0, "by": "a"})))
+ a.mutate_doc(move |doc| view::write_path(doc, &written, &json!({"at": 0, "by": "a"})))
.await
.expect("write forget record");