remove BaseClientBuild::client, expose ExtraMiddleware (#12133)

close #12127 

as discussed in #12127 remove unused BaseClientBuild::client field, and
make base_client::ExtraMiddleware public.
This commit is contained in:
James Z.M. Gao
2025-03-12 18:43:21 +08:00
committed by GitHub
parent c1a0bb85ea
commit 7fc4e076c1
3 changed files with 2 additions and 16 deletions
-8
View File
@@ -50,7 +50,6 @@ pub struct BaseClientBuilder<'a> {
native_tls: bool,
retries: u32,
pub connectivity: Connectivity,
client: Option<Client>,
markers: Option<&'a MarkerEnvironment>,
platform: Option<&'a Platform>,
auth_integration: AuthIntegration,
@@ -85,7 +84,6 @@ impl BaseClientBuilder<'_> {
native_tls: false,
connectivity: Connectivity::Online,
retries: DEFAULT_RETRIES,
client: None,
markers: None,
platform: None,
auth_integration: AuthIntegration::default(),
@@ -127,12 +125,6 @@ impl<'a> BaseClientBuilder<'a> {
self
}
#[must_use]
pub fn client(mut self, client: Client) -> Self {
self.client = Some(client);
self
}
#[must_use]
pub fn markers(mut self, markers: &'a MarkerEnvironment) -> Self {
self.markers = Some(markers);
+1 -1
View File
@@ -1,5 +1,5 @@
pub use base_client::{
is_extended_transient_error, AuthIntegration, BaseClient, BaseClientBuilder,
is_extended_transient_error, AuthIntegration, BaseClient, BaseClientBuilder, ExtraMiddleware,
UvRetryableStrategy, DEFAULT_RETRIES,
};
pub use cached_client::{CacheControl, CachedClient, CachedClientError, DataWithCachePolicy};
+1 -7
View File
@@ -8,7 +8,7 @@ use async_http_range_reader::AsyncHttpRangeReader;
use futures::{FutureExt, StreamExt, TryStreamExt};
use http::HeaderMap;
use itertools::Either;
use reqwest::{Client, Response, StatusCode};
use reqwest::{Response, StatusCode};
use reqwest_middleware::ClientWithMiddleware;
use tokio::sync::Semaphore;
use tracing::{info_span, instrument, trace, warn, Instrument};
@@ -115,12 +115,6 @@ impl<'a> RegistryClientBuilder<'a> {
self
}
#[must_use]
pub fn client(mut self, client: Client) -> Self {
self.base_client_builder = self.base_client_builder.client(client);
self
}
#[must_use]
pub fn extra_middleware(mut self, middleware: ExtraMiddleware) -> Self {
self.base_client_builder = self.base_client_builder.extra_middleware(middleware);