Skip to main content

GlideClientConfiguration

Struct GlideClientConfiguration 

Source
#[non_exhaustive]
pub struct GlideClientConfiguration {
Show 17 fields pub addresses: Vec<NodeAddress>, pub tls: TlsConfig, pub credentials: Option<ServerCredentials>, pub read_from: ReadFrom, pub node_discovery_mode: NodeDiscoveryMode, pub request_timeout: Option<Duration>, pub connection_timeout: Option<Duration>, pub reconnect_strategy: Option<BackoffStrategy>, pub database_id: i64, pub client_name: Option<String>, pub protocol: ProtocolVersion, pub inflight_requests_limit: Option<u32>, pub lazy_connect: bool, pub pubsub_subscriptions: Option<PubSubSubscriptions>, pub force_pubsub_channel: bool, pub root_certs: Vec<Vec<u8>>, pub client_identity: Option<ClientIdentity>,
}
Expand description

Configuration for a standalone (non-cluster) GLIDE client.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§addresses: Vec<NodeAddress>

Seed node addresses.

§tls: TlsConfig

TLS mode.

§credentials: Option<ServerCredentials>

Optional credentials.

§read_from: ReadFrom

Read strategy.

§node_discovery_mode: NodeDiscoveryMode

How the client discovers node roles and topology.

§request_timeout: Option<Duration>

Overall request timeout.

§connection_timeout: Option<Duration>

Connection establishment timeout.

§reconnect_strategy: Option<BackoffStrategy>

Reconnection backoff strategy.

§database_id: i64

Logical database index to SELECT on connect.

§client_name: Option<String>

Client name reported to the server (CLIENT SETNAME).

§protocol: ProtocolVersion

RESP protocol version.

§inflight_requests_limit: Option<u32>

Maximum number of concurrent in-flight requests.

§lazy_connect: bool

Defer connecting until the first command is issued.

§pubsub_subscriptions: Option<PubSubSubscriptions>

Pub/Sub subscriptions to establish on connect.

§force_pubsub_channel: bool

Force creation of the Pub/Sub push channel even when no subscriptions are configured, so runtime subscribe/unsubscribe can receive messages. See crate::commands::pubsub::PubSubCommands.

§root_certs: Vec<Vec<u8>>

Custom CA certificate(s) (PEM bytes) to trust when verifying the server under TlsConfig::SecureTls. Lowered into ConnectionRequest::root_certs. Empty = use the system trust store.

§client_identity: Option<ClientIdentity>

Client certificate + private key for mutual TLS. Set via Self::client_identity. Only meaningful together with TlsConfig::SecureTls.

Implementations§

Source§

impl GlideClientConfiguration

Source

pub fn with_address(host: impl Into<String>, port: u16) -> Self

Configure for a single host:port.

Source

pub fn tls(self, tls: TlsConfig) -> Self

Set TLS mode.

Source

pub fn tls_ca_cert(self, pem: impl Into<Vec<u8>>) -> Self

Trust a custom CA certificate (PEM bytes) when verifying the server with TlsConfig::SecureTls. Enables secure TLS against a server presenting a certificate signed by a private/self-signed CA. May be called more than once to trust multiple CAs.

Source

pub fn client_identity( self, cert_pem: impl Into<Vec<u8>>, key_pem: impl Into<Vec<u8>>, ) -> Self

Set a client certificate + private key (both PEM) for mutual TLS. The server must be configured to require/verify client certificates. Only meaningful together with TlsConfig::SecureTls.

Source

pub fn credentials(self, creds: ServerCredentials) -> Self

Set credentials.

Source

pub fn read_from(self, read_from: ReadFrom) -> Self

Set read strategy.

Source

pub fn request_timeout(self, timeout: Duration) -> Self

Set request timeout.

Source

pub fn connection_timeout(self, timeout: Duration) -> Self

Set the connection-establishment timeout.

Source

pub fn inflight_requests_limit(self, limit: u32) -> Self

Set the maximum number of concurrent in-flight requests.

Source

pub fn client_name(self, name: impl Into<String>) -> Self

Set client name.

Source

pub fn protocol(self, protocol: ProtocolVersion) -> Self

Set protocol version.

Source

pub fn lazy_connect(self, lazy: bool) -> Self

Enable lazy connection.

Source

pub fn reconnect_strategy(self, strategy: BackoffStrategy) -> Self

Set reconnection strategy.

Source

pub fn subscriptions(self, subscriptions: PubSubSubscriptions) -> Self

Set Pub/Sub subscriptions to establish on connect.

Source

pub fn enable_pubsub(self) -> Self

Enable the Pub/Sub push channel without configuring any connect-time subscriptions, so the client can use runtime subscribe/unsubscribe and receive messages via get_pubsub_message. Connect-time subscriptions enable this implicitly.

Note: runtime subscriptions are session-scoped — unlike connect-time subscriptions they are not automatically restored after a reconnect.

Source§

impl GlideClientConfiguration

Source

pub fn new(addresses: Vec<NodeAddress>) -> Self

Create a standalone configuration for the given addresses.

Source

pub fn from_url(url: impl AsRef<str>) -> ValkeyResult<Self>

Build a configuration from a connection URL.

Supports Redis URLs:

use glide::GlideClientConfiguration;
let url = "redis://user:pass@localhost:6379/2";
let cfg = GlideClientConfiguration::from_url(url).unwrap();
assert_eq!(cfg.database_id, 2);

rediss:// enables TLS with full verification; rediss://…/#insecure disables certificate verification.

Does not support Unix-socket URLs (unix:// or unix+redis://). Does not support Valkey URLs (valkey:// or valkeys://).

Source

pub fn database_id(self, db: i64) -> Self

Set database id.

Source

pub fn node_discovery_mode(self, mode: NodeDiscoveryMode) -> Self

Set how the client discovers node roles and topology.

Trait Implementations§

Source§

impl Clone for GlideClientConfiguration

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GlideClientConfiguration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

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

Source§

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