pub struct Config {
pub ca_path: Option<PathBuf>,
pub cert_path: Option<PathBuf>,
pub key_path: Option<PathBuf>,
pub timeout: Duration,
pub keyspace: Option<String>,
}
Expand description
The configuration for either a RawClient
or a
TransactionClient
.
See also TransactionOptions
which provides more ways to configure
requests.
Fields§
§ca_path: Option<PathBuf>
§cert_path: Option<PathBuf>
§key_path: Option<PathBuf>
§timeout: Duration
§keyspace: Option<String>
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_security(
self,
ca_path: impl Into<PathBuf>,
cert_path: impl Into<PathBuf>,
key_path: impl Into<PathBuf>,
) -> Self
pub fn with_security( self, ca_path: impl Into<PathBuf>, cert_path: impl Into<PathBuf>, key_path: impl Into<PathBuf>, ) -> Self
Set the certificate authority, certificate, and key locations for clients.
By default, this client will use an insecure connection over instead of one protected by Transport Layer Security (TLS). Your deployment may have chosen to rely on security measures such as a private network, or a VPN layer to provide secure transmission.
To use a TLS secured connection, use the with_security
function to set the required
parameters.
TiKV does not currently offer encrypted storage (or encryption-at-rest).
§Examples
let config = Config::default().with_security("root.ca", "internal.cert", "internal.key");
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the timeout for clients.
The timeout is used for all requests when using or connecting to a TiKV cluster (including PD nodes). If the request does not complete within timeout, the request is cancelled and an error returned to the user.
The default timeout is two seconds.
§Examples
let config = Config::default().with_timeout(Duration::from_secs(10));
Sourcepub fn with_default_keyspace(self) -> Self
pub fn with_default_keyspace(self) -> Self
Set to use default keyspace.
Server should enable storage.api-version = 2
to use this feature.
Sourcepub fn with_keyspace(self, keyspace: &str) -> Self
pub fn with_keyspace(self, keyspace: &str) -> Self
Set the use keyspace for the client.
Server should enable storage.api-version = 2
to use this feature.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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>,
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§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