aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/layout/schema.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-11-09 16:32:31 +0100
committerAlex Auvolat <alex@adnab.me>2023-11-09 16:32:31 +0100
commitdf36cf3099f6010c4fc62109b85d4d1e62f160cc (patch)
treec2ad68640220da38796d63f24117cf56f3f77bb9 /src/rpc/layout/schema.rs
parent9d95f6f7040c1899715ae4f984313427b1432758 (diff)
downloadgarage-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.rs9
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,
}
}
}