diff options
| author | tv <tv@krebsco.de> | 2026-10-20 01:36:34 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-20 01:36:34 +0200 |
| commit | 3acbbd6cd6b64c6c39408dd254cc2dbcab1b3e65 (patch) | |
| tree | afaf883aeb949cdd79d7ef360ba9ee197072e368 /src/compaction/mod.rs | |
| parent | 31dddb08e4f36392ed9b033f78efd00c243c46bb (diff) | |
add epoch catch-up / snapshots
Diffstat (limited to 'src/compaction/mod.rs')
| -rw-r--r-- | src/compaction/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/compaction/mod.rs b/src/compaction/mod.rs index 69c633e..e97d9c8 100644 --- a/src/compaction/mod.rs +++ b/src/compaction/mod.rs @@ -4,6 +4,7 @@ //! * `records`: the replicated compaction records under `_continuum/compactions/<id>`. //! * `coordinator`: proposal, settle period and decision on the node that was asked. //! * `switch`: switching this node to a committed epoch (worker). +//! * `catchup`: fetching a newer epoch from a peer (late, new or failed nodes). //! * `delta`: replaying this node's changes since the base into the new epoch. //! * `local`: per-node in-memory state (prebuilt snapshots, switch status, archive). //! * `api`: `/admin/compaction(s)` handlers. @@ -12,6 +13,7 @@ //! depends on `AppState`, peers or sync internals. mod api; +mod catchup; mod coordinator; mod delta; mod local; @@ -19,6 +21,7 @@ mod records; pub(crate) mod snapshot; mod switch; +pub(crate) use catchup::{receive_snapshot_reply, serve_snapshot}; pub(crate) use local::Compaction; pub(crate) use switch::run_worker; @@ -35,6 +38,7 @@ use tokio::sync::broadcast; use crate::replica::Epoch; use crate::sync::ChangeSet; +use crate::transport::ParsedMessage; /// What compaction needs from the node. Implemented by `AppState`. /// @@ -57,6 +61,16 @@ pub(crate) trait Host: Clone + Send + Sync + 'static { /// Known (not forgotten) peers. fn peer_summaries(&self) -> impl Future<Output = Vec<PeerSummary>> + Send; + /// True if `peer` completed the handshake as a member of our cluster. + fn is_cluster_member(&self, peer: &str) -> impl Future<Output = bool> + Send; + + /// Sends a message to a peer over the transport. + fn send_message( + &self, + peer: &str, + message: ParsedMessage, + ) -> impl Future<Output = anyhow::Result<()>> + Send; + /// Store paths touched by each published document change. fn subscribe_changes(&self) -> broadcast::Receiver<Arc<ChangeSet>>; @@ -97,6 +111,10 @@ pub(crate) struct PeerSummary { pub(crate) id: String, /// Not dormant. pub(crate) active: bool, + /// Handshake completed. + pub(crate) established: bool, + /// The epoch the peer last advertised. + pub(crate) epoch: Option<Epoch>, } /// Admin routes. Merged into the authenticated part of the node's router. |
