pub(crate) struct ConnectorOptions {
allow_http: bool,
timeout: Option<Duration>,
connect_timeout: Option<Duration>,
http1_only: bool,
user_agent: Option<String>,
}Expand description
The client options AwcHttpConnector::connect understands, parsed from osc::ClientOptions.
Fields§
§allow_http: boolWhether plaintext HTTP is permitted (enforced in AwcClient::call).
timeout: Option<Duration>Overall request timeout; None means it was explicitly disabled.
connect_timeout: Option<Duration>Connection-establishment timeout; None means it was explicitly disabled.
http1_only: boolRestrict to HTTP/1.1 (no HTTP/2); see ConnectorOptions::build_client.
user_agent: Option<String>User-Agent header to send; None falls back to awc’s default.
Implementations§
Source§impl ConnectorOptions
impl ConnectorOptions
Sourceconst HONORED_CLIENT_OPTIONS: &[(ClientConfigKey, fn(ConnectorOptions, ClientConfigKey, String) -> Result<ConnectorOptions>)]
const HONORED_CLIENT_OPTIONS: &[(ClientConfigKey, fn(ConnectorOptions, ClientConfigKey, String) -> Result<ConnectorOptions>)]
The client options the awc connector honors, each paired with how it is applied. This is the
single source of truth for them: connect folds exactly these keys,
ConnectorOptions::honors_client_config_key derives membership from it, and the S3 store
builder rejects every other transport client option — those would only configure the built-in
HTTP client we replaced. (The builder still accepts a non-transport client key it can apply
without the transport — DefaultContentType, a request header — see object_store.rs.)
Supporting one more transport option is a single entry here.
Sourcefn parse_bool(key: ClientConfigKey, value: &str) -> Result<bool>
fn parse_bool(key: ClientConfigKey, value: &str) -> Result<bool>
Parse bool client option. C.f. https://github.com/apache/arrow-rs-object-store/blob/6c5b299d4274219ecd406cc4828b94efe4a14f8d/src/config.rs#L74-L86
Sourcefn parse_duration(key: ClientConfigKey, value: String) -> Result<Duration>
fn parse_duration(key: ClientConfigKey, value: String) -> Result<Duration>
Parses a duration client option, rejecting one too large to be a real deadline: each request
turns the timeout into an Instant::now() + duration deadline, which overflows (panics) for
absurd values.
C.f. https://github.com/apache/arrow-rs-object-store/blob/6c5b299d4274219ecd406cc4828b94efe4a14f8d/src/config.rs#L88-L95
Sourcepub(crate) fn honors_client_config_key(key: &ClientConfigKey) -> bool
pub(crate) fn honors_client_config_key(key: &ClientConfigKey) -> bool
Whether AwcHttpConnector::connect reads key back from
osc::ClientOptions — i.e. whether it is in ConnectorOptions::HONORED_CLIENT_OPTIONS.
The S3 store builder rejects every other client option (see DefaultObjectStore).
Sourcefn spawn_worker(self) -> Result<UnboundedSender<Job>>
fn spawn_worker(self) -> Result<UnboundedSender<Job>>
Spawns a worker thread — a current-thread runtime + LocalSet owning one awc::Client built
from these options — and returns the channel that feeds it, or the error if the thread could
not be spawned. The worker thread stops when the channel is closed/dropped.
awc::Client is !Send, but osc::HttpService must be Send + Sync: awc drives connections
with tokio::task::spawn_local (so it needs a LocalSet) and its futures can’t be awaited
inside the Send future osc::HttpService::call returns. We run our own thread rather than
the caller’s runtime because object_store does not promise the caller is on a LocalSet. The
thread exits once the returned sender and every clone are dropped (i.e. when the owning object
store is).
The runtime is built here, on the caller’s thread (a Runtime is Send), then moved into the
worker — so a failed runtime build surfaces as a construction-time error rather than letting
every later request fail opaquely with Error::WorkerStopped. The awc::Client is still
built on the worker thread, since it is !Send; that build is effectively infallible here (the
process-wide rustls provider is installed in main before any store is constructed).
Sourcefn build_client(&self) -> Client
fn build_client(&self) -> Client
Builds the worker’s awc::Client from these options: the user_agent and http1_only. The
request and connect timeouts are not applied here — awc’s own timeouts don’t match reqwest’s
semantics (its request timeout bounds only the response head, and its connect timeout is two
per-phase budgets that can sum to ~2× the configured value). Instead Job::serve enforces
both as single wall-clock deadlines per request, started when the request is initiated (see
Job::deadline and Job::connect_deadline), matching reqwest. We therefore disable awc’s
built-in response timeout so its default cannot also fire.
When http1_only is set (object_store defaults it to true, since HTTP/2 multiplexes onto a
single TCP connection, which is slower for bulk object transfers) we restrict the client to
HTTP/1.1. This goes through Connector::max_http_version, which rebuilds the TLS config
advertising only http/1.1 in ALPN — still via ClientConfig::builder(), so it keeps the
process-wide post-quantum rustls provider (see crate::misc::rustls_ext); swapping the
connector in does not drop post-quantum key exchange.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConnectorOptions
impl RefUnwindSafe for ConnectorOptions
impl Send for ConnectorOptions
impl Sync for ConnectorOptions
impl Unpin for ConnectorOptions
impl UnsafeUnpin for ConnectorOptions
impl UnwindSafe for ConnectorOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more