diff options
| author | tv <tv@krebsco.de> | 2026-10-24 13:09:22 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-24 13:09:22 +0200 |
| commit | 1df85d13453b717dbee8f4ebf47b87de4f647866 (patch) | |
| tree | e86df90da61f74320c99aa5b19f5871c6918f09d /src/remake/mod.rs | |
| parent | c852ea8478963f5298e5b186ca5e1d7284504fd1 (diff) | |
introduce majority voting on remakes
Diffstat (limited to 'src/remake/mod.rs')
| -rw-r--r-- | src/remake/mod.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/remake/mod.rs b/src/remake/mod.rs index 6a9c6f9..0895931 100644 --- a/src/remake/mod.rs +++ b/src/remake/mod.rs @@ -2,10 +2,11 @@ //! 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 -//! where writes made after the base go): `compact` and `replace`. +//! where writes made after the base go): `compact`, `replace` and `import`. //! * `snapshot`: deterministic build of the next epoch's initial document. //! * `records`: the replicated remake records under `_continuum/remakes/<id>`. -//! * `coordinator`: proposal, settle period and decision on the node that was asked. +//! * `coordinator`: proposal, vote count and decision on the node that was asked. +//! * `vote`: who votes, for which remake, and when a remake has its majority. //! * `switch`: switching this node to a committed epoch (worker). //! * `catchup`: rejoining a newer epoch from peers (late, new or failed nodes), then //! replaying or quarantining this node's own missing changes. @@ -27,6 +28,7 @@ mod quarantine; mod records; pub(crate) mod snapshot; mod switch; +mod vote; pub(crate) use local::RemakeState; pub(crate) use switch::run_worker; @@ -59,9 +61,13 @@ pub(crate) trait Host: Clone + Send + Sync + 'static { /// The epoch of the local replica. fn current_epoch(&self) -> Epoch; - /// Lower bound and default basis for the settle period. + /// Default basis for the voting period, and the grace margin after it. fn dormant_after(&self) -> Duration; + /// The electorate of a remake proposed now (`vote`): the members that said they are + /// alive recently enough, read from `doc`. + fn electorate(&self, doc: &AutoCommit, now_ms: u64) -> Vec<String>; + fn is_node_ready(&self) -> impl Future<Output = bool> + Send; /// Known (not forgotten) peers. |
