aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/bootstrap.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 13:25:11 +0100
committertv <tv@krebsco.de>2026-10-31 13:25:11 +0100
commitbaf9498c69340da18001c7ca2c223ed45fddc249 (patch)
tree54074c4120653442ab00368d94be5b33c6aefe10 /src/swarm/bootstrap.rs
parent2c4a60b91bf60b0d87a862641a6016b1f7a251ec (diff)
rename AutoMerge to Document
Diffstat (limited to 'src/swarm/bootstrap.rs')
-rw-r--r--src/swarm/bootstrap.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/swarm/bootstrap.rs b/src/swarm/bootstrap.rs
index a9ab1b2..ec9a355 100644
--- a/src/swarm/bootstrap.rs
+++ b/src/swarm/bootstrap.rs
@@ -18,7 +18,6 @@ use std::collections::HashSet;
use std::path::Path;
use anyhow::{Context, Result, bail};
-use automerge::{ActorId, AutoCommit};
use serde_json::Value as JsonValue;
use tokio::time::Instant;
use tracing::{debug, info, warn};
@@ -28,6 +27,7 @@ use crate::document;
use crate::document::meta::{self, SWARM};
use crate::document::replica::Epoch;
use crate::document::store;
+use crate::document::{ActorId, Document};
use crate::files::{FileKind, Files};
use crate::force::Force;
use crate::remake::snapshot;
@@ -156,7 +156,7 @@ fn swarm_id_path() -> Vec<String> {
}
/// The swarm ID the document names, if any.
-fn read_swarm_id(doc: &AutoCommit) -> Option<String> {
+fn read_swarm_id(doc: &Document) -> Option<String> {
match store::read_path(doc, &swarm_id_path()) {
Ok(Some(JsonValue::String(id))) if !id.is_empty() => Some(id),
_ => None,
@@ -184,7 +184,7 @@ impl Origin {
/// A document the node starts from, ready at once: on the swarm and epoch it names.
pub(crate) struct StartingDocument {
/// Under a fresh actor.
- pub(crate) doc: AutoCommit,
+ pub(crate) doc: Document,
pub(crate) epoch: Epoch,
pub(crate) swarm_id: String,
pub(crate) origin: Origin,
@@ -281,7 +281,7 @@ pub(crate) fn starting_document(
/// The swarm and epoch `doc` is on.
fn identify(
- mut doc: AutoCommit,
+ mut doc: Document,
origin: Origin,
earlier_actors: Vec<ActorId>,
) -> Result<StartingDocument> {
@@ -301,12 +301,12 @@ fn identify(
}
/// A backup to recover from, as `GET /admin/document` saves it, under a fresh actor.
-fn load_backup(path: &Path, files: &Files) -> Result<AutoCommit> {
+fn load_backup(path: &Path, files: &Files) -> Result<Document> {
let bytes = files
.read(FileKind::Backup, path)
.with_context(|| format!("Reading the backup {}", path.display()))?
.with_context(|| format!("The backup {} doesn't exist", path.display()))?;
- Ok(AutoCommit::load(&bytes)
+ Ok(Document::load(&bytes)
.with_context(|| format!("Loading the backup {}", path.display()))?
.with_actor(ActorId::random()))
}