diff options
author | Alex Auvolat <alex@adnab.me> | 2023-11-08 17:49:06 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-11-08 17:49:06 +0100 |
commit | fe9af1dcaae31a117528a9cfa10c422c9a850201 (patch) | |
tree | 6e43dbb97d37d48f6af5398b4d067747e652108c /src/rpc/rpc_helper.rs | |
parent | 4a9c94514f49aa4e9880a8e0f5cf5a52d11ae993 (diff) | |
download | garage-fe9af1dcaae31a117528a9cfa10c422c9a850201.tar.gz garage-fe9af1dcaae31a117528a9cfa10c422c9a850201.zip |
WIP: garage_rpc: store layout version history
Diffstat (limited to 'src/rpc/rpc_helper.rs')
-rw-r--r-- | src/rpc/rpc_helper.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/rpc/rpc_helper.rs b/src/rpc/rpc_helper.rs index 56bef2f3..3fdb4acd 100644 --- a/src/rpc/rpc_helper.rs +++ b/src/rpc/rpc_helper.rs @@ -26,7 +26,7 @@ use garage_util::data::*; use garage_util::error::Error; use garage_util::metrics::RecordDuration; -use crate::layout::ClusterLayout; +use crate::layout::LayoutHistory; use crate::metrics::RpcMetrics; // Default RPC timeout = 5 minutes @@ -91,7 +91,7 @@ pub struct RpcHelper(Arc<RpcHelperInner>); struct RpcHelperInner { our_node_id: Uuid, fullmesh: Arc<FullMeshPeeringStrategy>, - layout_watch: watch::Receiver<Arc<ClusterLayout>>, + layout_watch: watch::Receiver<Arc<LayoutHistory>>, metrics: RpcMetrics, rpc_timeout: Duration, } @@ -100,7 +100,7 @@ impl RpcHelper { pub(crate) fn new( our_node_id: Uuid, fullmesh: Arc<FullMeshPeeringStrategy>, - layout_watch: watch::Receiver<Arc<ClusterLayout>>, + layout_watch: watch::Receiver<Arc<LayoutHistory>>, rpc_timeout: Option<Duration>, ) -> Self { let metrics = RpcMetrics::new(); @@ -392,8 +392,8 @@ impl RpcHelper { pub fn request_order(&self, nodes: &[Uuid]) -> Vec<Uuid> { // Retrieve some status variables that we will use to sort requests let peer_list = self.0.fullmesh.get_peer_list(); - let layout: Arc<ClusterLayout> = self.0.layout_watch.borrow().clone(); - let our_zone = match layout.node_role(&self.0.our_node_id) { + let layout: Arc<LayoutHistory> = self.0.layout_watch.borrow().clone(); + let our_zone = match layout.current().node_role(&self.0.our_node_id) { Some(pc) => &pc.zone, None => "", }; @@ -407,7 +407,7 @@ impl RpcHelper { let mut nodes = nodes .iter() .map(|to| { - let peer_zone = match layout.node_role(to) { + let peer_zone = match layout.current().node_role(to) { Some(pc) => &pc.zone, None => "", }; |