Struct edgedb_tokio::Builder
source · pub struct Builder { /* private fields */ }
Expand description
A builder used to create connections.
Implementations§
source§impl Builder
impl Builder
sourcepub fn credentials(
&mut self,
credentials: &Credentials
) -> Result<&mut Self, Error>
pub fn credentials( &mut self, credentials: &Credentials ) -> Result<&mut Self, Error>
Set connection parameters as credentials structure
sourcepub fn credentials_file(&mut self, path: impl AsRef<Path>) -> &mut Self
pub fn credentials_file(&mut self, path: impl AsRef<Path>) -> &mut Self
Set connection parameters from file
Note: file is not read immediately but is read when configuration is being built.
sourcepub fn user(&mut self, user: &str) -> Result<&mut Self, Error>
pub fn user(&mut self, user: &str) -> Result<&mut Self, Error>
Set the user name for authentication.
sourcepub fn password(&mut self, password: &str) -> &mut Self
pub fn password(&mut self, password: &str) -> &mut Self
Set the password for SCRAM authentication.
sourcepub fn tls_ca_file(&mut self, path: &Path) -> &mut Self
pub fn tls_ca_file(&mut self, path: &Path) -> &mut Self
Set certificate authority for TLS from file
Note: file is not read immediately but is read when configuration is being built.
sourcepub fn tls_security(&mut self, value: TlsSecurity) -> &mut Self
pub fn tls_security(&mut self, value: TlsSecurity) -> &mut Self
Updates the client TLS security mode.
By default, the certificate chain is always verified; but hostname verification is disabled if configured to use only a specific certificate, and enabled if root certificates are used.
sourcepub fn client_security(&mut self, value: ClientSecurity) -> &mut Self
pub fn client_security(&mut self, value: ClientSecurity) -> &mut Self
Modifies the client security mode.
InsecureDevMode changes tls_security only from Default to Insecure Strict ensures tls_security is also Strict
sourcepub fn pem_certificates(&mut self, cert_data: &str) -> Result<&mut Self, Error>
pub fn pem_certificates(&mut self, cert_data: &str) -> Result<&mut Self, Error>
Set the allowed certificate as a PEM file.
sourcepub fn secret_key(&mut self, secret_key: &str) -> &mut Self
pub fn secret_key(&mut self, secret_key: &str) -> &mut Self
Set the secret key for JWT authentication.
sourcepub fn wait_until_available(&mut self, time: Duration) -> &mut Self
pub fn wait_until_available(&mut self, time: Duration) -> &mut Self
Set the time to wait for the database server to become available.
This works by ignoring certain errors known to happen while the database is starting up or restarting (e.g. “connection refused” or early “connection reset”).
Note: the amount of time establishing a connection can take is the sum
of wait_until_available
plus connect_timeout
sourcepub fn connect_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn connect_timeout(&mut self, timeout: Duration) -> &mut Self
A timeout for a single connect attempt.
The default is 10 seconds. A subsecond timeout should be fine for most networks. However, in some cases this can be much slower. That’s because this timeout includes authentication, during which:
- The password is checked (slow by design).
- A compiler process is launched (slow now, may be optimized later).
So in a concurrent case on slower VMs (such as CI with parallel tests), 10 seconds is more reasonable default.
The wait_until_available
setting should be larger than this value to
allow multiple attempts.
Note: the amount of time establishing a connection can take is the sum
of wait_until_available
plus connect_timeout
sourcepub fn max_concurrency(&mut self, value: usize) -> &mut Self
pub fn max_concurrency(&mut self, value: usize) -> &mut Self
Set the maximum number of underlying database connections.