Skip to content

Commit b29a5e7

Browse files
authored
Refactor client traits (#1022)
Introduce mockable versions of all services
1 parent d21a257 commit b29a5e7

File tree

17 files changed

+1364
-851
lines changed

17 files changed

+1364
-851
lines changed

client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ backoff = "0.4"
2020
base64 = "0.22"
2121
derive_builder = { workspace = true }
2222
derive_more = { workspace = true }
23+
dyn-clone = "1.0"
2324
bytes = "1.10"
2425
futures-util = { version = "0.3", default-features = false }
2526
futures-retry = "0.6.0"

client/src/lib.rs

Lines changed: 241 additions & 255 deletions
Large diffs are not rendered by default.

client/src/metrics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ fn code_as_screaming_snake(code: &Code) -> &'static str {
208208

209209
/// Implements metrics functionality for gRPC (really, any http) calls
210210
#[derive(Debug, Clone)]
211-
pub struct GrpcMetricSvc {
211+
pub(crate) struct GrpcMetricSvc {
212212
pub(crate) inner: ChannelOrGrpcOverride,
213213
// If set to none, metrics are a no-op
214214
pub(crate) metrics: Option<MetricsContext>,
@@ -230,6 +230,7 @@ impl fmt::Debug for ChannelOrGrpcOverride {
230230
}
231231
}
232232

233+
// TODO: Rewrite as a RawGrpcCaller implementation
233234
impl Service<http::Request<Body>> for GrpcMetricSvc {
234235
type Response = http::Response<Body>;
235236
type Error = Box<dyn std::error::Error + Send + Sync>;

0 commit comments

Comments
 (0)