Struct tikv_client::Config
source · pub struct Config {
pub ca_path: Option<PathBuf>,
pub cert_path: Option<PathBuf>,
pub key_path: Option<PathBuf>,
pub timeout: Duration,
}
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
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));
Trait Implementations§
source§impl<'de> Deserialize<'de> for Configwhere
Config: Default,
impl<'de> Deserialize<'de> for Configwhere Config: Default,
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 PartialEq for Config
impl PartialEq for Config
impl Eq for Config
impl StructuralEq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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