diff options
Diffstat (limited to 'src/remake/catchup.rs')
| -rw-r--r-- | src/remake/catchup.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/remake/catchup.rs b/src/remake/catchup.rs index 81c56a0..db25251 100644 --- a/src/remake/catchup.rs +++ b/src/remake/catchup.rs @@ -11,7 +11,7 @@ //! exactly like a new node joining; //! 3. once caught up with a peer, checks that the history starts with the epoch's //! snapshot change; -//! 4. decides about its own changes the cluster never saw (none, for a new node): +//! 4. decides about its own changes the swarm never saw (none, for a new node): //! * the metadata of the epoch that followed the node's own records which changes //! went into it (per-actor clock); the rest are this node's missing changes; //! * within that epoch's replay window they are replayed (state per path, as in a @@ -374,7 +374,7 @@ fn prepare(mut copy: AutoCommit, mut old: AutoCommit, previous: Epoch, target: E (None, _) => Plan::Quarantine { paths, reason: format!( - "the metadata of the epoch after {previous} is missing, so it is unknown which of {} local changes the cluster has", + "the metadata of the epoch after {previous} is missing, so it is unknown which of {} local changes the swarm has", missing.own ), }, @@ -386,7 +386,7 @@ fn prepare(mut copy: AutoCommit, mut old: AutoCommit, previous: Epoch, target: E Plan::Quarantine { paths, reason: format!( - "{} local changes are outside the replay window ({gap} epochs behind, cluster moved on {}s ago)", + "{} local changes are outside the replay window ({gap} epochs behind, swarm moved on {}s ago)", missing.own, away_ms / 1000 ), @@ -448,7 +448,7 @@ mod tests { use automerge::{ActorId, ROOT, transaction::Transactable}; use serde_json::{Value as JsonValue, json}; - /// An old-epoch document with one own change after the base, and the cluster's + /// An old-epoch document with one own change after the base, and the swarm's /// document of the next epoch (snapshot plus one foreign change). fn scenario(policy: &JsonValue) -> (AutoCommit, AutoCommit, Epoch) { let mut old = AutoCommit::new().with_actor(ActorId::from(&b"late-node"[..])); @@ -472,19 +472,19 @@ mod tests { .unwrap(); let target = snapshot.epoch; - let mut cluster = snapshot.doc.with_actor(ActorId::from(&b"cluster-node"[..])); - cluster.put(ROOT, "theirs", 1_i64).unwrap(); - cluster.commit(); + let mut swarm = snapshot.doc.with_actor(ActorId::from(&b"swarm-node"[..])); + swarm.put(ROOT, "theirs", 1_i64).unwrap(); + swarm.commit(); old.put(ROOT, "mine", 1_i64).unwrap(); old.commit(); - (old, cluster, target) + (old, swarm, target) } #[test] fn replays_within_the_window() { - let (old, cluster, target) = scenario(&json!({})); - match prepare(cluster, old, Epoch::GENESIS, target) { + let (old, swarm, target) = scenario(&json!({})); + match prepare(swarm, old, Epoch::GENESIS, target) { Prepared::Ready { plan: Plan::Replay(paths, _), own_missing, @@ -499,8 +499,8 @@ mod tests { #[test] fn quarantines_outside_the_window() { - let (old, cluster, target) = scenario(&json!({ "replayWindow": { "epochs": 0 } })); - match prepare(cluster, old, Epoch::GENESIS, target) { + let (old, swarm, target) = scenario(&json!({ "replayWindow": { "epochs": 0 } })); + match prepare(swarm, old, Epoch::GENESIS, target) { Prepared::Ready { plan: Plan::Quarantine { paths, .. }, .. @@ -511,9 +511,9 @@ mod tests { #[test] fn new_node_has_nothing_to_replay() { - let (_, cluster, target) = scenario(&json!({})); + let (_, swarm, target) = scenario(&json!({})); assert!(matches!( - prepare(cluster, AutoCommit::new(), Epoch::GENESIS, target), + prepare(swarm, AutoCommit::new(), Epoch::GENESIS, target), Prepared::Ready { plan: Plan::Nothing, had_history: false, |
