mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-09-04 11:15:41 +00:00
chore: rename strat into strategy to improve redability
`strat` is reported as error by typos
This commit is contained in:
+9
-9
@@ -236,7 +236,7 @@ impl PeeringManager {
|
|||||||
);
|
);
|
||||||
known_hosts.update_hash();
|
known_hosts.update_hash();
|
||||||
|
|
||||||
let strat = Arc::new(Self {
|
let strategy = Arc::new(Self {
|
||||||
netapp: netapp.clone(),
|
netapp: netapp.clone(),
|
||||||
known_hosts: RwLock::new(known_hosts),
|
known_hosts: RwLock::new(known_hosts),
|
||||||
public_peer_list: ArcSwap::new(Arc::new(Vec::new())),
|
public_peer_list: ArcSwap::new(Arc::new(Vec::new())),
|
||||||
@@ -246,22 +246,22 @@ impl PeeringManager {
|
|||||||
ping_timeout_millis: DEFAULT_PING_TIMEOUT_MILLIS.into(),
|
ping_timeout_millis: DEFAULT_PING_TIMEOUT_MILLIS.into(),
|
||||||
});
|
});
|
||||||
|
|
||||||
strat.update_public_peer_list(&strat.known_hosts.read().unwrap());
|
strategy.update_public_peer_list(&strategy.known_hosts.read().unwrap());
|
||||||
|
|
||||||
strat.ping_endpoint.set_handler(strat.clone());
|
strategy.ping_endpoint.set_handler(strategy.clone());
|
||||||
strat.peer_list_endpoint.set_handler(strat.clone());
|
strategy.peer_list_endpoint.set_handler(strategy.clone());
|
||||||
|
|
||||||
let strat2 = strat.clone();
|
let strategy2 = strategy.clone();
|
||||||
netapp.on_connected(move |id: NodeID, addr: SocketAddr, is_incoming: bool| {
|
netapp.on_connected(move |id: NodeID, addr: SocketAddr, is_incoming: bool| {
|
||||||
strat2.on_connected(id, addr, is_incoming);
|
strategy2.on_connected(id, addr, is_incoming);
|
||||||
});
|
});
|
||||||
|
|
||||||
let strat2 = strat.clone();
|
let strategy2 = strategy.clone();
|
||||||
netapp.on_disconnected(move |id: NodeID, is_incoming: bool| {
|
netapp.on_disconnected(move |id: NodeID, is_incoming: bool| {
|
||||||
strat2.on_disconnected(id, is_incoming);
|
strategy2.on_disconnected(id, is_incoming);
|
||||||
});
|
});
|
||||||
|
|
||||||
strat
|
strategy
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run the full mesh peering strategy.
|
/// Run the full mesh peering strategy.
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ impl RpcHelper {
|
|||||||
endpoint: &Endpoint<M, H>,
|
endpoint: &Endpoint<M, H>,
|
||||||
to: Uuid,
|
to: Uuid,
|
||||||
msg: N,
|
msg: N,
|
||||||
strat: RequestStrategy<()>,
|
strategy: RequestStrategy<()>,
|
||||||
) -> Result<S, Error>
|
) -> Result<S, Error>
|
||||||
where
|
where
|
||||||
M: Rpc<Response = Result<S, Error>>,
|
M: Rpc<Response = Result<S, Error>>,
|
||||||
@@ -185,12 +185,12 @@ impl RpcHelper {
|
|||||||
|
|
||||||
let node_id = to.into();
|
let node_id = to.into();
|
||||||
let rpc_call = endpoint
|
let rpc_call = endpoint
|
||||||
.call_streaming(&node_id, msg, strat.rs_priority)
|
.call_streaming(&node_id, msg, strategy.rs_priority)
|
||||||
.with_context(Context::current_with_span(span))
|
.with_context(Context::current_with_span(span))
|
||||||
.record_duration(&self.0.metrics.rpc_duration, &metric_tags);
|
.record_duration(&self.0.metrics.rpc_duration, &metric_tags);
|
||||||
|
|
||||||
let timeout = async {
|
let timeout = async {
|
||||||
match strat.rs_timeout {
|
match strategy.rs_timeout {
|
||||||
Timeout::None => futures::future::pending().await,
|
Timeout::None => futures::future::pending().await,
|
||||||
Timeout::Default => tokio::time::sleep(self.0.rpc_timeout).await,
|
Timeout::Default => tokio::time::sleep(self.0.rpc_timeout).await,
|
||||||
Timeout::Custom(t) => tokio::time::sleep(t).await,
|
Timeout::Custom(t) => tokio::time::sleep(t).await,
|
||||||
@@ -222,7 +222,7 @@ impl RpcHelper {
|
|||||||
endpoint: &Endpoint<M, H>,
|
endpoint: &Endpoint<M, H>,
|
||||||
to: &[Uuid],
|
to: &[Uuid],
|
||||||
msg: N,
|
msg: N,
|
||||||
strat: RequestStrategy<()>,
|
strategy: RequestStrategy<()>,
|
||||||
) -> Result<Vec<(Uuid, Result<S, Error>)>, Error>
|
) -> Result<Vec<(Uuid, Result<S, Error>)>, Error>
|
||||||
where
|
where
|
||||||
M: Rpc<Response = Result<S, Error>>,
|
M: Rpc<Response = Result<S, Error>>,
|
||||||
@@ -237,7 +237,7 @@ impl RpcHelper {
|
|||||||
|
|
||||||
let resps = join_all(
|
let resps = join_all(
|
||||||
to.iter()
|
to.iter()
|
||||||
.map(|to| self.call(endpoint, *to, msg.clone(), strat.clone())),
|
.map(|to| self.call(endpoint, *to, msg.clone(), strategy.clone())),
|
||||||
)
|
)
|
||||||
.with_context(Context::current_with_span(span))
|
.with_context(Context::current_with_span(span))
|
||||||
.await;
|
.await;
|
||||||
@@ -252,7 +252,7 @@ impl RpcHelper {
|
|||||||
&self,
|
&self,
|
||||||
endpoint: &Endpoint<M, H>,
|
endpoint: &Endpoint<M, H>,
|
||||||
msg: N,
|
msg: N,
|
||||||
strat: RequestStrategy<()>,
|
strategy: RequestStrategy<()>,
|
||||||
) -> Result<Vec<(Uuid, Result<S, Error>)>, Error>
|
) -> Result<Vec<(Uuid, Result<S, Error>)>, Error>
|
||||||
where
|
where
|
||||||
M: Rpc<Response = Result<S, Error>>,
|
M: Rpc<Response = Result<S, Error>>,
|
||||||
@@ -266,7 +266,7 @@ impl RpcHelper {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|p| p.id.into())
|
.map(|p| p.id.into())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
self.call_many(endpoint, &to[..], msg, strat).await
|
self.call_many(endpoint, &to[..], msg, strategy).await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Make a RPC call to multiple servers, returning either a Vec of responses,
|
/// Make a RPC call to multiple servers, returning either a Vec of responses,
|
||||||
|
|||||||
Reference in New Issue
Block a user