From 2cba03fa6af4aeca176d69514603bce26b9c934a Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 18:39:31 +0100 Subject: remake coordination use document, not automerge --- src/remake/mod.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/remake/mod.rs') diff --git a/src/remake/mod.rs b/src/remake/mod.rs index c77d56d..9206bbf 100644 --- a/src/remake/mod.rs +++ b/src/remake/mod.rs @@ -45,7 +45,6 @@ use std::future::Future; use std::sync::Arc; use std::time::Duration; -use automerge::AutoCommit; use axum::{ Router, extract::DefaultBodyLimit, @@ -53,6 +52,7 @@ use axum::{ }; use tokio::sync::broadcast; +use crate::document::Document; use crate::document::replica::Epoch; use crate::document::store::ChangeSet; @@ -74,7 +74,7 @@ pub(crate) struct Summary { } /// The `Summary` of `remake` with the records of `doc`, whose epoch is `epoch`. -pub(crate) fn summary(remake: &RemakeState, doc: &AutoCommit, epoch: Epoch) -> Summary { +pub(crate) fn summary(remake: &RemakeState, doc: &Document, epoch: Epoch) -> Summary { let local = records::EpochRecord::from(epoch); let mut summary = Summary { rejoining: remake.is_rejoining(), @@ -129,14 +129,14 @@ pub(crate) trait Host: Clone + Send + Sync + 'static { /// The electorate of a remake proposed now (`vote`): the members that said they are /// alive recently enough, read from `doc`. - fn electorate(&self, doc: &AutoCommit, now: crate::clock::UnixMillis) -> Vec; + fn electorate(&self, doc: &Document, now: crate::clock::UnixMillis) -> Vec; /// Downloads a change from peers on the local epoch, in chunks from several at once, /// checked against its hash. fn fetch_change( &self, - hash: automerge::ChangeHash, - ) -> impl Future> + Send; + hash: crate::document::ChangeHash, + ) -> impl Future> + Send; /// Downloads content of `size` bytes by its BLAKE3 hash from peers on the local /// epoch, checked against it. @@ -163,7 +163,7 @@ pub(crate) trait Host: Clone + Send + Sync + 'static { /// Serves reads from this document (read-only, marked stale) while the node is not /// ready; `None` ends it. - fn set_stale_view(&self, view: Option<(Epoch, AutoCommit)>); + fn set_stale_view(&self, view: Option<(Epoch, Document)>); /// Whether the document caught up with a peer since the last reset. fn initial_sync_done(&self) -> bool; @@ -177,13 +177,13 @@ pub(crate) trait Host: Clone + Send + Sync + 'static { /// Reads the document on the blocking pool. fn read_doc(&self, f: F) -> impl Future + Send where - F: FnOnce(&AutoCommit) -> T + Send + 'static, + F: FnOnce(&Document) -> T + Send + 'static, T: Send + 'static; /// One committed change (rolled back on error), published and replicated. fn commit_doc(&self, f: F) -> impl Future> + Send where - F: FnOnce(&mut AutoCommit) -> Result + Send + 'static, + F: FnOnce(&mut Document) -> Result + Send + 'static, T: Send + 'static, E: Send + 'static; @@ -194,9 +194,9 @@ pub(crate) trait Host: Clone + Send + Sync + 'static { &self, epoch: Epoch, f: F, - ) -> impl Future> + Send + ) -> impl Future> + Send where - F: FnOnce(&mut AutoCommit) -> Result + Send + 'static, + F: FnOnce(&mut Document) -> Result + Send + 'static, E: Send + 'static; } -- cgit v1.3.1