Struct eventstore::ClientSettings
source · [−]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
sourceimpl 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 parse(input: &str) -> IResult<&str, Self>
pub fn parse_str(input: &str) -> Result<Self, ClientSettingsParseError>
pub fn to_uri(&self, endpoint: &Endpoint) -> Uri
Trait Implementations
sourceimpl Clone for ClientSettings
impl Clone for ClientSettings
sourcefn clone(&self) -> ClientSettings
fn clone(&self) -> ClientSettings
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ClientSettings
impl Debug for ClientSettings
sourceimpl Default for ClientSettings
impl Default for ClientSettings
sourceimpl<'de> Deserialize<'de> for ClientSettings
impl<'de> Deserialize<'de> for ClientSettings
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl FromStr for ClientSettings
impl FromStr for ClientSettings
sourceimpl PartialEq<ClientSettings> for ClientSettings
impl PartialEq<ClientSettings> for ClientSettings
sourcefn eq(&self, other: &ClientSettings) -> bool
fn eq(&self, other: &ClientSettings) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ClientSettings) -> bool
fn ne(&self, other: &ClientSettings) -> bool
This method tests for !=
.
sourceimpl Serialize for ClientSettings
impl Serialize for ClientSettings
impl Eq for ClientSettings
impl StructuralEq for ClientSettings
impl StructuralPartialEq for ClientSettings
Auto Trait Implementations
impl RefUnwindSafe for ClientSettings
impl Send for ClientSettings
impl Sync for ClientSettings
impl Unpin for ClientSettings
impl UnwindSafe for ClientSettings
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more