pub struct ClientOptions { /* private fields */ }Expand description
Connection settings for
ArcadeDbClient::connect_with.
Defaults: plaintext transport, 30 connect attempts with a 400ms backoff, no per-request deadline.
Implementations§
Source§impl ClientOptions
impl ClientOptions
Sourcepub fn new(
addr: impl Into<String>,
user: impl Into<String>,
pass: impl Into<String>,
database: impl Into<String>,
) -> Self
pub fn new( addr: impl Into<String>, user: impl Into<String>, pass: impl Into<String>, database: impl Into<String>, ) -> Self
Settings for addr (host:port), credentials, and the default
database — plaintext transport, default retry policy.
Sourcepub fn open_or_create(self, yes: bool) -> Self
pub fn open_or_create(self, yes: bool) -> Self
After connecting, create database if it does not exist (as a
"graph" database). Tolerates the AlreadyExists race — two
bootstrapping workers pointing at the same fresh database both
succeed.
Sourcepub fn tls(self, config: ClientTlsConfig) -> Self
pub fn tls(self, config: ClientTlsConfig) -> Self
Use a TLS transport with this config (e.g.
ClientTlsConfig::new().ca_certificate(..)). Implies the https
scheme; without it the channel is plaintext.
Sourcepub fn connect_timeout(self, timeout: Duration) -> Self
pub fn connect_timeout(self, timeout: Duration) -> Self
Per-attempt TCP connect deadline (a cold JVM that accepts nothing fails the attempt fast instead of hanging).
Sourcepub fn connect_attempts(self, attempts: u32) -> Self
pub fn connect_attempts(self, attempts: u32) -> Self
How many times to retry the TCP connect before giving up (default 30).
Sourcepub fn connect_backoff(self, backoff: Duration) -> Self
pub fn connect_backoff(self, backoff: Duration) -> Self
Delay between connect attempts (default 400ms).
Sourcepub fn request_timeout(self, timeout: Duration) -> Self
pub fn request_timeout(self, timeout: Duration) -> Self
Default per-request gRPC deadline, applied to every call that does
not set its own timeout. Prevents a hung server from stalling callers
forever (and the Transaction drop-guard from
silently rolling back a wedged transaction).
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Read settings from the environment with the standard ARCADEDB_
prefix: ARCADEDB_ADDR, ARCADEDB_USER, ARCADEDB_PASSWORD,
ARCADEDB_DATABASE. Missing/empty variables are a
ArcadeDbError::InvalidInput naming the first offender.
Sourcepub fn from_env_prefix(prefix: &str) -> Result<Self>
pub fn from_env_prefix(prefix: &str) -> Result<Self>
from_env with a custom prefix ({PREFIX}_ADDR, …).
Trait Implementations§
Source§impl Clone for ClientOptions
impl Clone for ClientOptions
Auto Trait Implementations§
impl Freeze for ClientOptions
impl RefUnwindSafe for ClientOptions
impl Send for ClientOptions
impl Sync for ClientOptions
impl Unpin for ClientOptions
impl UnsafeUnpin for ClientOptions
impl UnwindSafe for ClientOptions
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<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