diff options
author | Alex Auvolat <alex@adnab.me> | 2023-11-09 16:32:31 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-11-09 16:32:31 +0100 |
commit | df36cf3099f6010c4fc62109b85d4d1e62f160cc (patch) | |
tree | c2ad68640220da38796d63f24117cf56f3f77bb9 /src/rpc/layout/schema.rs | |
parent | 9d95f6f7040c1899715ae4f984313427b1432758 (diff) | |
download | garage-df36cf3099f6010c4fc62109b85d4d1e62f160cc.tar.gz garage-df36cf3099f6010c4fc62109b85d4d1e62f160cc.zip |
layout: add helpers to LayoutHistory and prepare integration with Table
Diffstat (limited to 'src/rpc/layout/schema.rs')
-rw-r--r-- | src/rpc/layout/schema.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rpc/layout/schema.rs b/src/rpc/layout/schema.rs index db60c806..89f5c361 100644 --- a/src/rpc/layout/schema.rs +++ b/src/rpc/layout/schema.rs @@ -375,14 +375,17 @@ impl UpdateTracker { changed } - pub(crate) fn set_max(&mut self, peer: Uuid, value: u64) { + pub(crate) fn set_max(&mut self, peer: Uuid, value: u64) -> bool { match self.0.get_mut(&peer) { - Some(e) => { - *e = std::cmp::max(*e, value); + Some(e) if *e < value => { + *e = value; + true } None => { self.0.insert(peer, value); + true } + _ => false, } } } |