diff options
| author | tv <tv@krebsco.de> | 2026-10-21 14:51:51 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-21 14:51:51 +0200 |
| commit | 0850433577942b8e65d3dacc060f2548b93d9c17 (patch) | |
| tree | 9f28581e20dd91e9e534ee36ab2c65dc8dc8a851 /src/remake | |
| parent | b9782f827229b9e3e6053e065229cfef0e7983c3 (diff) | |
rename cluster to swarm everywhere!
Diffstat (limited to 'src/remake')
| -rw-r--r-- | src/remake/api.rs | 4 | ||||
| -rw-r--r-- | src/remake/catchup.rs | 28 | ||||
| -rw-r--r-- | src/remake/coordinator.rs | 2 | ||||
| -rw-r--r-- | src/remake/mod.rs | 4 | ||||
| -rw-r--r-- | src/remake/snapshot.rs | 16 |
5 files changed, 27 insertions, 27 deletions
diff --git a/src/remake/api.rs b/src/remake/api.rs index d3d1912..5267e48 100644 --- a/src/remake/api.rs +++ b/src/remake/api.rs @@ -4,7 +4,7 @@ //! /admin/compaction` is a shortcut, kept from before). The receiving //! node becomes its coordinator. `202` with the report, or with `?wait=true` the final //! report once decided. A dropped request does not abort anything. `?force=true` -//! accepts a `settleSecs` below the dormancy threshold (tests, single-site clusters). +//! accepts a `settleSecs` below the dormancy threshold (tests, single-site swarms). //! * `GET /admin/remakes` lists all remakes. //! * `GET /admin/remakes/{id}` reports one; `?wait=true` long-polls until decided //! (bounded by the proposal's own expiry). @@ -22,7 +22,7 @@ //! "settleSecs": 480, "switchDelaySecs": 60 }` //! //! `?force=true` accepts `settleSecs` below the dormancy threshold and `switchDelaySecs` -//! below one keepalive interval: for tests and debugging, not for real clusters. +//! below one keepalive interval: for tests and debugging, not for real swarms. //! //! `kind` is `compact` (no spec) or `replace`, whose spec is //! `{ "document": {…store root…}, "rules": [{"from": "a", "to": "b"}, {"from": "c", "drop": true}] }` diff --git a/src/remake/catchup.rs b/src/remake/catchup.rs index c8878cc..4aa66e7 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::{transaction::Transactable, ActorId, ROOT}; use serde_json::{json, Value as JsonValue}; - /// 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, diff --git a/src/remake/coordinator.rs b/src/remake/coordinator.rs index b84b0a9..d1b3397 100644 --- a/src/remake/coordinator.rs +++ b/src/remake/coordinator.rs @@ -1,4 +1,4 @@ -//! The coordinator: the node that received the proposal watches the cluster during the +//! The coordinator: the node that received the proposal watches the swarm during the //! settle period and then writes the decision. //! //! It aborts if, at any point before deciding: diff --git a/src/remake/mod.rs b/src/remake/mod.rs index c1014d7..68a0665 100644 --- a/src/remake/mod.rs +++ b/src/remake/mod.rs @@ -1,4 +1,4 @@ -//! Remakes: coordinated moves of the whole cluster to a new document, a new epoch. +//! Remakes: coordinated moves of the whole swarm to a new document, a new epoch. //! Compaction is one: the new document has the old one's content without its history. //! //! * `kind`: what differs between kinds of remake (building the new document, and @@ -66,7 +66,7 @@ pub(crate) trait Host: Clone + Send + Sync + 'static { /// Known (not forgotten) peers. fn peer_summaries(&self) -> impl Future<Output = Vec<PeerSummary>> + Send; - /// Stops serving requests (back to `Joining`, keeping the cluster ID), as while a + /// Stops serving requests (back to `Joining`, keeping the swarm ID), as while a /// rejoin syncs a fresh document. Returns whether the node was serving. fn suspend(&self) -> impl Future<Output = bool> + Send; diff --git a/src/remake/snapshot.rs b/src/remake/snapshot.rs index 507d8ac..bd99854 100644 --- a/src/remake/snapshot.rs +++ b/src/remake/snapshot.rs @@ -139,7 +139,7 @@ pub(crate) struct EpochMetadata { /// Highest sequence number per actor of `previous` contained in the snapshot. pub(crate) clock: BTreeMap<String, u64>, pub(crate) policy: Policy, - /// When the remake was proposed (unix ms): the point the cluster moved on. + /// When the remake was proposed (unix ms): the point the swarm moved on. pub(crate) proposed_at: u64, /// The remake kind and its translation input, for writes made before the epoch. pub(crate) kind: String, @@ -206,7 +206,7 @@ fn parse_metadata(doc: &AutoCommit, generation: u64) -> Result<EpochMetadata, St /// the same generation. Returns the metadata. /// /// This does not prove the snapshot's content matches the old epoch; the hash commits -/// to it, and the peer is a cluster member trusted as much as for ordinary sync. +/// to it, and the peer is a swarm member trusted as much as for ordinary sync. pub(crate) fn verify_document(doc: &mut AutoCommit, epoch: Epoch) -> Result<EpochMetadata, String> { let root = ChangeHash(epoch.id); let Some(change) = doc.get_change_by_hash(&root) else { @@ -653,14 +653,14 @@ mod tests { let policy = json!({}); let mut snap = build(&mut late, ¶ms(&base, &policy)).unwrap(); - // Meanwhile the cluster moved on in the new epoch. - let mut cluster = snap + // Meanwhile the swarm moved on in the new epoch. + let mut swarm = snap .doc .fork() - .with_actor(ActorId::from(&b"cluster-node"[..])); - cluster.put(ROOT, "new", 1_i64).unwrap(); - cluster.commit(); - let bytes = cluster.save(); + .with_actor(ActorId::from(&b"swarm-node"[..])); + swarm.put(ROOT, "new", 1_i64).unwrap(); + swarm.commit(); + let bytes = swarm.save(); late.put(ROOT, "mine", "late").unwrap(); late.commit(); |
