aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/remake/api.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/remake/api.rs b/src/remake/api.rs
index 325f9ba..f2330e7 100644
--- a/src/remake/api.rs
+++ b/src/remake/api.rs
@@ -996,6 +996,21 @@ pub(crate) mod testing {
into_json(abort_by_id(host, id.to_owned(), query, Some(user.to_owned())).await).await
}
+ /// What a node serving an epoch it made up does: switches to `epoch`, its document
+ /// `doc` (that epoch's snapshot alone), written to by a fresh writer.
+ pub(crate) async fn serve<H: Host>(
+ host: &H,
+ epoch: crate::document::replica::Epoch,
+ doc: crate::document::Document,
+ ) {
+ let node = host.node_id();
+ let mut doc = doc.with_actor(crate::document::ActorId::random());
+ crate::document::replica::authored(&mut doc, &node);
+ host.switch_epoch(epoch, move |_| Ok::<_, ()>(doc))
+ .await
+ .expect("switched to the epoch");
+ }
+
/// What a coordinator proposing against the protocol does: proposes remake `id`'s
/// proposal again, under a new ID, whatever is open. The new ID.
pub(crate) async fn propose_again<H: Host>(host: &H, id: &str) -> String {