From baf9498c69340da18001c7ca2c223ed45fddc249 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 13:25:11 +0100 Subject: rename AutoMerge to Document --- src/state/host.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/state/host.rs') diff --git a/src/state/host.rs b/src/state/host.rs index 912a187..a878381 100644 --- a/src/state/host.rs +++ b/src/state/host.rs @@ -6,7 +6,6 @@ use std::sync::Arc; use std::time::Duration; use anyhow::Result; -use automerge::{AutoCommit, ChangeHash}; use tokio::sync::broadcast; use tokio::time::Instant; use tracing::debug; @@ -14,6 +13,7 @@ use tracing::debug; use super::{AppState, HelloState, NodeLifecycle, StaleView, Standing}; use crate::document::replica::Epoch; use crate::document::store::ChangeSet; +use crate::document::{ChangeHash, Document}; use crate::remake::{Host, PeerSummary, RemakeState}; impl AppState { @@ -86,14 +86,14 @@ impl Host for AppState { crate::swarm::skew::measure(self).await } - fn electorate(&self, doc: &AutoCommit, now: crate::clock::UnixMillis) -> Vec { + fn electorate(&self, doc: &Document, now: crate::clock::UnixMillis) -> Vec { crate::swarm::members::electorate(doc, now.as_u64(), self.electorate_window) } fn fetch_change( &self, hash: ChangeHash, - ) -> impl Future> + Send { + ) -> impl Future> + Send { let state = self.clone(); async move { let peers = state.active_peers_on_local_epoch().await; @@ -184,7 +184,7 @@ impl Host for AppState { } } - fn set_stale_view(&self, view: Option<(Epoch, AutoCommit)>) { + fn set_stale_view(&self, view: Option<(Epoch, Document)>) { self.set_stale(view.map(|(epoch, doc)| StaleView { epoch, doc: Arc::new(doc), @@ -209,7 +209,7 @@ impl Host for AppState { 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, { let state = self.clone(); @@ -218,7 +218,7 @@ impl Host for AppState { 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, { @@ -230,16 +230,16 @@ impl Host for AppState { &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, { let state = self.clone(); async move { let swapped = { let state = state.clone(); - tokio::task::spawn_blocking(move || -> Result { + tokio::task::spawn_blocking(move || -> Result { let mut replica = state.doc.blocking_write(); let new_doc = f(&mut replica.doc)?; let old_doc = std::mem::replace(&mut replica.doc, new_doc); -- cgit v1.3.1