Skip to main content

ConnectorOptions

Struct ConnectorOptions 

Source
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: bool

Whether 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: bool

Restrict 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

Source

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.

Source

fn parse_bool(key: ClientConfigKey, value: &str) -> Result<bool>

Source

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

Source

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).

Source

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).

Source

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§

Source§

impl Default for ConnectorOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,