diff options
| author | tv <tv@krebsco.de> | 2026-10-25 20:33:40 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-25 20:33:40 +0100 |
| commit | ed1a0c7105ea1af3d20ebea902bf538b56714050 (patch) | |
| tree | 387a56a645dea84f849302c4be063e74adb6dca5 /src/document | |
| parent | c027da65b18e7a9e78d406f4f24cd2808ca2d901 (diff) | |
late messages don't flip peer's epoch back
Diffstat (limited to 'src/document')
| -rw-r--r-- | src/document/replica.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/document/replica.rs b/src/document/replica.rs index e24f93c..db47223 100644 --- a/src/document/replica.rs +++ b/src/document/replica.rs @@ -86,6 +86,9 @@ impl fmt::Debug for Epoch { /// [`Replica::heads`]. pub struct Replica { pub epoch: Epoch, + /// How many times this node changed epoch (switch, rejoin, abandoned rejoin) in this + /// run: messages carry it, so a late one can't flip a peer's view of our epoch back. + pub epoch_seq: u32, pub doc: AutoCommit, heads: Vec<ChangeHash>, } @@ -94,6 +97,7 @@ impl Replica { pub fn new(epoch: Epoch, doc: AutoCommit) -> Self { let mut replica = Self { epoch, + epoch_seq: 0, doc, heads: Vec::new(), }; |
