pub struct DriverOptions {
pub tls_config: DriverTlsConfig,
pub request_timeout: Duration,
pub primary_failover_retries: usize,
}Expand description
TypeDB driver connection options.
DriverOptions object can be used to override the default driver behavior while connecting to
TypeDB.
§Examples
let options = DriverOptions::new(DriverTlsConfig::default()).request_timeout(Duration::from_secs(30));Fields§
§tls_config: DriverTlsConfigSpecifies the TLS configuration of the connection to TypeDB. WARNING: Disabled TLS settings will make the driver sending passwords as plaintext. Defaults to an enabled TLS configuration based on the system’s native trust roots.
request_timeout: DurationSpecifies the maximum time to wait for a response to a unary RPC request. This applies to operations like database creation, user management, and initial transaction opening. It does NOT apply to operations within transactions (queries, commits). Defaults to 2 hours.
primary_failover_retries: usizeSpecifies the number of retries the driver performs to find and reach the cluster primary
after a failed request, before giving up. Total attempts per user request = N + 1.
Each retry either follows the server’s redirect address (fast path) or polls the
known replicas with a 2-second sleep between polls (slow path).
Set to 0 to disable failover. Defaults to 1.
Implementations§
Source§impl DriverOptions
impl DriverOptions
Sourcepub fn new(tls_config: DriverTlsConfig) -> Self
pub fn new(tls_config: DriverTlsConfig) -> Self
Creates new DriverOptions to configure connections to TypeDB using custom TLS settings.
WARNING: Disabled TLS settings will make the driver sending passwords as plaintext.
Sourcepub fn tls_config(self, tls_config: DriverTlsConfig) -> Self
pub fn tls_config(self, tls_config: DriverTlsConfig) -> Self
Override the existing TLS configuration. WARNING: Disabled TLS settings will make the driver sending passwords as plaintext.
Sourcepub fn request_timeout(self, request_timeout: Duration) -> Self
pub fn request_timeout(self, request_timeout: Duration) -> Self
Specifies the maximum time to wait for a response to a unary RPC request. This applies to operations like database creation, user management, and initial transaction opening. It does NOT apply to operations within transactions (queries, commits). Defaults to 2 hours.
Sourcepub fn primary_failover_retries(self, primary_failover_retries: usize) -> Self
pub fn primary_failover_retries(self, primary_failover_retries: usize) -> Self
Specifies the number of retries the driver performs to find and reach the cluster primary
after a failed request, before giving up. Total attempts per user request = N + 1.
Each retry either follows the server’s redirect address (fast path) or polls the
known replicas with a 2-second sleep between polls (slow path).
Set to 0 to disable failover. Defaults to 1.
Trait Implementations§
Source§impl Clone for DriverOptions
impl Clone for DriverOptions
Source§fn clone(&self) -> DriverOptions
fn clone(&self) -> DriverOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DriverOptions
impl Debug for DriverOptions
Auto Trait Implementations§
impl Freeze for DriverOptions
impl RefUnwindSafe for DriverOptions
impl Send for DriverOptions
impl Sync for DriverOptions
impl Unpin for DriverOptions
impl UnsafeUnpin for DriverOptions
impl UnwindSafe for DriverOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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