pub struct ClientSettings { /* private fields */ }
Expand description
Gathers all the settings related to a gRPC client with an EventStoreDB database.
ClientSettings
can only be created when parsing a connection string.
let setts = "esdb://localhost:1234?tls=false".parse::<ClientSettings>()?;
You can declare a single-node or a cluster-mode client while only using a connection string. For example, you can define a cluster-mode client based on a fixed set of gossip seeds:
let setts = "esdb://localhost:1111,localhost:2222,localhost:3333".parse::<ClientSettings>()?;
Same example except we are using DNS discovery this time. The client will perform SRV queries to resolve all the node associated to that domain:
let setts = "esdb+discover://mydomain:1234".parse::<ClientSettings>()?;
ClientSettings
supports a wide range of settings. If a setting is not mentioned in the
connection string, that setting default value is used.
-
maxDiscoverAttempts
: default3
. Maximum number of DNS discovery attempts before the connection gives up. -
discoveryInterval
: default500ms
. Waiting period between discovery attempts. -
gossipTimeout
: default3s
: Waiting period before a gossip request timeout. TODO - Current behavior doesn’t timeout at all. -
tls
: defaulttrue
. Use a secure connection. -
tlsVerifyCert
: defaulttrue
. When using a secure connection, perform a certification verification. -
nodePreference
: defaultrandom
. When in a cluster connection, indicates what type of node a connection should pick. Keep in mind that’s best effort. Supported values are:leader
random
follower
readOnlyReplica
-
keepAliveInterval
: default10s
-
keepAliveTimeout
: default10s
Implementations§
Source§impl ClientSettings
impl ClientSettings
pub fn is_dns_discovery_enabled(&self) -> bool
pub fn hosts(&self) -> &Vec<Endpoint>
pub fn max_discover_attempts(&self) -> usize
pub fn discovery_interval(&self) -> Duration
pub fn gossip_timeout(&self) -> Duration
pub fn node_preference(&self) -> NodePreference
pub fn is_secure_mode_enabled(&self) -> bool
pub fn is_tls_certificate_verification_enabled(&self) -> bool
pub fn default_authenticated_user(&self) -> &Option<Credentials>
pub fn to_uri(&self, endpoint: &Endpoint) -> Uri
pub fn user_certificate(&self) -> Option<(&String, &String)>
pub fn tls_ca_file(&self) -> Option<&String>
Trait Implementations§
Source§impl Clone for ClientSettings
impl Clone for ClientSettings
Source§fn clone(&self) -> ClientSettings
fn clone(&self) -> ClientSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ClientSettings
impl Debug for ClientSettings
Source§impl Default for ClientSettings
impl Default for ClientSettings
Source§impl<'de> Deserialize<'de> for ClientSettings
impl<'de> Deserialize<'de> for ClientSettings
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl FromStr for ClientSettings
impl FromStr for ClientSettings
Source§impl PartialEq for ClientSettings
impl PartialEq for ClientSettings
Source§impl Serialize for ClientSettings
impl Serialize for ClientSettings
impl Eq for ClientSettings
impl StructuralPartialEq for ClientSettings
Auto Trait Implementations§
impl !Freeze for ClientSettings
impl RefUnwindSafe for ClientSettings
impl Send for ClientSettings
impl Sync for ClientSettings
impl Unpin for ClientSettings
impl UnwindSafe for ClientSettings
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request