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 | 5afb7f3bb4d8a5b26374a1f79b69862f43f09763 (patch) | |
| tree | e24ca17bc1da4022264a88b90286d2ac3da994a1 /src/document | |
| parent | 700cbf841d1cd62ad5ee2bf6fa867c92fccf5a4d (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(), }; |
