aboutsummaryrefslogtreecommitdiffstats
path: root/src/remake/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 18:39:31 +0100
committertv <tv@krebsco.de>2026-10-31 18:39:31 +0100
commit4a6403d0242cf730a3f864c8d26e0ba15a98fcf0 (patch)
treefddd3aee30d2874c8bb07dad29731892a1ff610a /src/remake/mod.rs
parent88b3d05543561d5a34a4ff96b9a8ca9351e1a98d (diff)
remake coordination use document, not automerge
Diffstat (limited to 'src/remake/mod.rs')
-rw-r--r--src/remake/mod.rs20
1 files changed, 10 insertions, 10 deletions
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<String>;
+ fn electorate(&self, doc: &Document, now: crate::clock::UnixMillis) -> Vec<String>;
/// 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<Output = anyhow::Result<automerge::Change>> + Send;
+ hash: crate::document::ChangeHash,
+ ) -> impl Future<Output = anyhow::Result<crate::document::Change>> + 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<T, F>(&self, f: F) -> impl Future<Output = T> + 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<T, E, F>(&self, f: F) -> impl Future<Output = Result<T, E>> + Send
where
- F: FnOnce(&mut AutoCommit) -> Result<T, E> + Send + 'static,
+ F: FnOnce(&mut Document) -> Result<T, E> + 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<Output = Result<AutoCommit, E>> + Send
+ ) -> impl Future<Output = Result<Document, E>> + Send
where
- F: FnOnce(&mut AutoCommit) -> Result<AutoCommit, E> + Send + 'static,
+ F: FnOnce(&mut Document) -> Result<Document, E> + Send + 'static,
E: Send + 'static;
}