summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs3
-rw-r--r--src/remake/snapshot.rs8
-rw-r--r--src/state/mod.rs7
3 files changed, 5 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs
index 628a71e..0cda7ca 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -308,6 +308,3 @@ fn watch_for_shutdown() -> Result<watch::Receiver<bool>> {
async fn stopped(mut stop: watch::Receiver<bool>) {
let _ = stop.wait_for(|stop| *stop).await;
}
-
-// === Footnotes ===============================================================
-// [concurrent]: these comments are in place so we remember what to do if we go from async to concurrent.
diff --git a/src/remake/snapshot.rs b/src/remake/snapshot.rs
index d093a33..b8c784e 100644
--- a/src/remake/snapshot.rs
+++ b/src/remake/snapshot.rs
@@ -18,10 +18,6 @@
//! at the snapshot change itself, so edits made afterwards through the store API can't
//! change what the protocol sees.
-// `Snapshot::clock` is kept for returning nodes (step 7); late nodes read the clock from
-// the metadata instead.
-#![cfg_attr(not(test), allow(dead_code))]
-
use std::collections::BTreeMap;
use automerge::{ActorId, AutoCommit, ChangeHash, transaction::CommitOptions};
@@ -61,7 +57,9 @@ pub(crate) struct Snapshot {
/// A document consisting of exactly that one change.
pub(crate) doc: AutoCommit,
/// Highest sequence number per actor (hex) contained in the base. A change
- /// (actor, seq) is part of the snapshot iff seq <= clock[actor].
+ /// (actor, seq) is part of the snapshot iff seq <= clock[actor]. Read by tests only:
+ /// nodes read the clock from the epoch metadata (`EpochMetadata::clock`).
+ #[cfg_attr(not(test), allow(dead_code))]
pub(crate) clock: BTreeMap<String, u64>,
}
diff --git a/src/state/mod.rs b/src/state/mod.rs
index beac886..787fd8c 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -57,8 +57,6 @@ pub(crate) struct AppState {
pub(crate) lifecycle: Arc<RwLock<NodeLifecycle>>,
- // Serializes swarm-ID establishment, peer membership, and readiness transitions.
- //[concurrent]swarm_validation: Arc<Mutex<()>>,
pub(crate) peer_states: Arc<RwLock<HashMap<String, Arc<Mutex<PeerState>>>>>,
pub(crate) transport: Arc<dyn transport::Transport>,
pub(crate) firewall: Arc<Firewall>,
@@ -69,7 +67,8 @@ pub(crate) struct AppState {
pub(crate) sync_events: mpsc::UnboundedSender<SyncEvent>,
- // TODO see key_watchers.md ("Use a per-key notification registry instead of the global `watch<u64>`")
+ /// The document's version: bumped after every change (`notify_store_changed`). The
+ /// change publisher (`swarm::sync`) waits on it; a measurement compares it.
pub(crate) change_tx: watch::Sender<u64>,
pub(crate) initial_sync_done: Arc<AtomicBool>,
@@ -212,7 +211,6 @@ impl AppState {
// Record the expected swarm without making the node Ready. Bootstrap owns readiness.
pub(crate) async fn set_expected_swarm_id(&self, swarm_id: String) -> Result<()> {
- //[concurrent]let _guard = self.swarm_validation.lock().await;
let mut lifecycle = self.lifecycle.write().await;
match &*lifecycle {
NodeLifecycle::Joining {
@@ -256,7 +254,6 @@ impl AppState {
// Only bootstrap should call this, after validating document metadata.
pub(crate) async fn mark_ready(&self, swarm_id: String) -> Result<()> {
- //[concurrent]let _guard = self.swarm_validation.lock().await;
let mut lifecycle = self.lifecycle.write().await;
match &*lifecycle {
NodeLifecycle::Joining {