aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/layout/manager.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-11-16 13:26:43 +0100
committerAlex Auvolat <alex@adnab.me>2023-11-16 13:26:43 +0100
commitad5c6f779f7fdfdc0569920c830c59197023515a (patch)
tree0b1a46a5a89c93678b330e52313d0e47299adf0e /src/rpc/layout/manager.rs
parentd4df03424f1c7f3cc1eaba9e16d2e1d049131b97 (diff)
downloadgarage-ad5c6f779f7fdfdc0569920c830c59197023515a.tar.gz
garage-ad5c6f779f7fdfdc0569920c830c59197023515a.zip
layout: split helper in separate file; more precise difference tracking
Diffstat (limited to 'src/rpc/layout/manager.rs')
-rw-r--r--src/rpc/layout/manager.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rpc/layout/manager.rs b/src/rpc/layout/manager.rs
index 4e073d1f..85d94ffa 100644
--- a/src/rpc/layout/manager.rs
+++ b/src/rpc/layout/manager.rs
@@ -184,17 +184,20 @@ impl LayoutManager {
return Some(layout.clone());
}
}
+
None
}
fn merge_layout_trackers(&self, adv: &UpdateTrackers) -> Option<UpdateTrackers> {
let mut layout = self.layout.write().unwrap();
+
if layout.update_trackers != *adv {
if layout.update(|l| l.update_trackers.merge(adv)) {
layout.update_trackers(self.node_id);
return Some(layout.update_trackers.clone());
}
}
+
None
}
@@ -284,7 +287,7 @@ impl LayoutManager {
}
pub(crate) fn handle_pull_cluster_layout(&self) -> SystemRpc {
- let layout = self.layout.read().unwrap().clone(); // TODO: avoid cloning
+ let layout = self.layout.read().unwrap().clone();
SystemRpc::AdvertiseClusterLayout(layout)
}