pub struct Builder<T = Complete>(/* private fields */);
Expand description
A builder to construct Client
s and blocking::Client
s.
Implementations§
Source§impl Builder<ServiceStage>
impl Builder<ServiceStage>
Source§impl Builder<UserAgentStage>
impl Builder<UserAgentStage>
Sourcepub fn user_agent(self, user_agent: UserAgent) -> Builder
pub fn user_agent(self, user_agent: UserAgent) -> Builder
Sets the user agent sent by this client.
Source§impl Builder<Complete>
impl Builder<Complete>
Sourcepub fn from_config(self, config: &ServiceConfig) -> Self
pub fn from_config(self, config: &ServiceConfig) -> Self
Applies configuration settings from a ServiceConfig
to the builder.
Sourcepub fn get_service(&self) -> &str
pub fn get_service(&self) -> &str
Returns the builder’s configured service name.
Sourcepub fn get_user_agent(&self) -> &UserAgent
pub fn get_user_agent(&self) -> &UserAgent
Returns the builder’s configured user agent.
Sourcepub fn security(self, security: SecurityConfig) -> Self
pub fn security(self, security: SecurityConfig) -> Self
Sets the security configuration.
Defaults to an empty configuration.
Sourcepub fn get_security(&self) -> &SecurityConfig
pub fn get_security(&self) -> &SecurityConfig
Returns the builder’s configured security configuration.
Sourcepub fn proxy(self, proxy: ProxyConfig) -> Self
pub fn proxy(self, proxy: ProxyConfig) -> Self
Sets the proxy configuration.
Defaults to ProxyConfig::Direct
(i.e. no proxy).
Sourcepub fn get_proxy(&self) -> &ProxyConfig
pub fn get_proxy(&self) -> &ProxyConfig
Returns the builder’s configured proxy configuration.
Sourcepub fn connect_timeout(self, connect_timeout: Duration) -> Self
pub fn connect_timeout(self, connect_timeout: Duration) -> Self
Sets the connect timeout.
Defaults to 10 seconds.
Sourcepub fn get_connect_timeout(&self) -> Duration
pub fn get_connect_timeout(&self) -> Duration
Returns the builder’s configured connect timeout.
Sourcepub fn read_timeout(self, read_timeout: Duration) -> Self
pub fn read_timeout(self, read_timeout: Duration) -> Self
Sets the read timeout.
This timeout applies to socket-level read attempts.
Defaults to 5 minutes.
Sourcepub fn get_read_timeout(&self) -> Duration
pub fn get_read_timeout(&self) -> Duration
Returns the builder’s configured read timeout.
Sourcepub fn write_timeout(self, write_timeout: Duration) -> Self
pub fn write_timeout(self, write_timeout: Duration) -> Self
Sets the write timeout.
This timeout applies to socket-level write attempts.
Defaults to 5 minutes.
Sourcepub fn get_write_timeout(&self) -> Duration
pub fn get_write_timeout(&self) -> Duration
Returns the builder’s configured write timeout.
Sourcepub fn backoff_slot_size(self, backoff_slot_size: Duration) -> Self
pub fn backoff_slot_size(self, backoff_slot_size: Duration) -> Self
Sets the backoff slot size.
This is the upper bound on the initial delay before retrying a request. It grows exponentially as additional attempts are made for a given request.
Defaults to 250 milliseconds.
Sourcepub fn get_backoff_slot_size(&self) -> Duration
pub fn get_backoff_slot_size(&self) -> Duration
Returns the builder’s configured backoff slot size.
Sourcepub fn max_num_retries(self, max_num_retries: u32) -> Self
pub fn max_num_retries(self, max_num_retries: u32) -> Self
Sets the maximum number of times a request attempt will be retried before giving up.
Defaults to 4.
Sourcepub fn get_max_num_retries(&self) -> u32
pub fn get_max_num_retries(&self) -> u32
Returns the builder’s configured maximum number of retries.
Sourcepub fn client_qos(self, client_qos: ClientQos) -> Self
pub fn client_qos(self, client_qos: ClientQos) -> Self
Sets the client’s internal rate limiting behavior.
Defaults to ClientQos::Enabled
.
Sourcepub fn get_client_qos(&self) -> ClientQos
pub fn get_client_qos(&self) -> ClientQos
Returns the builder’s configured internal rate limiting behavior.
Sourcepub fn server_qos(self, server_qos: ServerQos) -> Self
pub fn server_qos(self, server_qos: ServerQos) -> Self
Sets the client’s behavior in response to a QoS error from the server.
Defaults to ServerQos::AutomaticRetry
.
Sourcepub fn get_server_qos(&self) -> ServerQos
pub fn get_server_qos(&self) -> ServerQos
Returns the builder’s configured server QoS behavior.
Sourcepub fn service_error(self, service_error: ServiceError) -> Self
pub fn service_error(self, service_error: ServiceError) -> Self
Sets the client’s behavior in response to a service error from the server.
Defaults to ServiceError::WrapInNewError
.
Sourcepub fn get_service_error(&self) -> ServiceError
pub fn get_service_error(&self) -> ServiceError
Returns the builder’s configured service error handling behavior.
Sourcepub fn idempotency(self, idempotency: Idempotency) -> Self
pub fn idempotency(self, idempotency: Idempotency) -> Self
Sets the client’s behavior to determine if a request is idempotent or not.
Only idempotent requests will be retried.
Defaults to Idempotency::ByMethod
.
Sourcepub fn get_idempotency(&self) -> Idempotency
pub fn get_idempotency(&self) -> Idempotency
Returns the builder’s configured idempotency handling behavior.
Sourcepub fn node_selection_strategy(
self,
node_selection_strategy: NodeSelectionStrategy,
) -> Self
pub fn node_selection_strategy( self, node_selection_strategy: NodeSelectionStrategy, ) -> Self
Sets the client’s strategy for selecting a node for a request.
Defaults to NodeSelectionStrategy::PinUntilError
.
Sourcepub fn get_node_selection_strategy(&self) -> NodeSelectionStrategy
pub fn get_node_selection_strategy(&self) -> NodeSelectionStrategy
Returns the builder’s configured node selection strategy.
Sourcepub fn metrics(self, metrics: Arc<MetricRegistry>) -> Self
pub fn metrics(self, metrics: Arc<MetricRegistry>) -> Self
Sets the metric registry used to register client metrics.
Defaults to no registry.
Sourcepub fn get_metrics(&self) -> Option<&Arc<MetricRegistry>>
pub fn get_metrics(&self) -> Option<&Arc<MetricRegistry>>
Returns the builder’s configured metric registry.
Sourcepub fn host_metrics(self, host_metrics: Arc<HostMetricsRegistry>) -> Self
pub fn host_metrics(self, host_metrics: Arc<HostMetricsRegistry>) -> Self
Sets the host metrics registry used to track host performance.
Defaults to no registry.
Sourcepub fn get_host_metrics(&self) -> Option<&Arc<HostMetricsRegistry>>
pub fn get_host_metrics(&self) -> Option<&Arc<HostMetricsRegistry>>
Returns the builder’s configured host metrics registry.
Sourcepub fn override_host_index(self, override_host_index: usize) -> Self
pub fn override_host_index(self, override_host_index: usize) -> Self
Overrides the hostIndex
field included in metrics.
Sourcepub fn get_override_host_index(&self) -> Option<usize>
pub fn get_override_host_index(&self) -> Option<usize>
Returns the builder’s hostIndex
override.
Source§impl Builder<Complete>
impl Builder<Complete>
Sourcepub fn blocking_handle(self, blocking_handle: Handle) -> Self
pub fn blocking_handle(self, blocking_handle: Handle) -> Self
Returns the Handle
to the tokio Runtime
to be used by blocking clients.
This has no effect on async clients.
Defaults to a conjure-runtime
internal Runtime
.
Sourcepub fn get_blocking_handle(&self) -> Option<&Handle>
pub fn get_blocking_handle(&self) -> Option<&Handle>
Returns the builder’s configured blocking handle.
Sourcepub fn build_blocking(&self) -> Result<Client, Error>
pub fn build_blocking(&self) -> Result<Client, Error>
Creates a new blocking::Client
.