pub struct ConnectionBuilder { /* private fields */ }
Expand description
Build connection to Tarantool.
Implementations§
Source§impl ConnectionBuilder
impl ConnectionBuilder
Sourcepub async fn build<A>(&self, addr: A) -> Result<Connection, Error>
pub async fn build<A>(&self, addr: A) -> Result<Connection, Error>
Create connection to Tarantool using provided address.
Sourcepub fn auth<'a>(
&mut self,
user: &str,
password: impl Into<Option<&'a str>>,
) -> &mut Self
pub fn auth<'a>( &mut self, user: &str, password: impl Into<Option<&'a str>>, ) -> &mut Self
Sets user login and, optionally, password, used for this connection.
AUTH message sent upon connecting to server.
Sourcepub fn timeout(&mut self, timeout: impl Into<Option<Duration>>) -> &mut Self
pub fn timeout(&mut self, timeout: impl Into<Option<Duration>>) -> &mut Self
Sets timeout for requests.
By default disabled.
Sourcepub fn transaction_timeout(
&mut self,
transaction_timeout: impl Into<Option<Duration>>,
) -> &mut Self
pub fn transaction_timeout( &mut self, transaction_timeout: impl Into<Option<Duration>>, ) -> &mut Self
Sets default timeout for transactions.
By default disabled.
Sourcepub fn transaction_isolation_level(
&mut self,
transaction_isolation_level: TransactionIsolationLevel,
) -> &mut Self
pub fn transaction_isolation_level( &mut self, transaction_isolation_level: TransactionIsolationLevel, ) -> &mut Self
Sets default transaction isolation level.
By default TransactionIsolationLevel::Default
(i.e. use box.cfg default value).
Sourcepub fn connect_timeout(
&mut self,
connect_timeout: impl Into<Option<Duration>>,
) -> &mut Self
pub fn connect_timeout( &mut self, connect_timeout: impl Into<Option<Duration>>, ) -> &mut Self
Sets timeout for connect.
By default disabled.
Sourcepub fn reconnect_interval(
&mut self,
reconnect_interval: impl Into<Option<ReconnectInterval>>,
) -> &mut Self
pub fn reconnect_interval( &mut self, reconnect_interval: impl Into<Option<ReconnectInterval>>, ) -> &mut Self
Sets interval between reconnection attempts.
If disabled, next attempt wil lbe started as soon as last one finished.
By default set to ReconnectInterval::exponential_backoff(Duration::from_millis(1), Duration::from_secs(1), 0.5, 5.0)
.
Sourcepub fn sql_statement_cache_capacity(&mut self, capacity: usize) -> &mut Self
pub fn sql_statement_cache_capacity(&mut self, capacity: usize) -> &mut Self
Sets capacity of SQL statment cache.
Setting 0 disables cache. By default set to 100.
Sourcepub fn internal_simultaneous_requests_threshold(
&mut self,
value: usize,
) -> &mut Self
pub fn internal_simultaneous_requests_threshold( &mut self, value: usize, ) -> &mut Self
Prepare Connection
to process value
number of simultaneously created requests.
It is not hard limit, but making more simultaneous requests than this value will result in degradation in performance, so try to increase this value, if you unsatisfied with performance.
Internally connection have multiple bounded channels, and this parameter mostly affect size of this channels. Increasing this value can help if you have a lot of simultaneously created requests, however this will increase memory consumption.
By default set to 500, which should be reasonable compromise between memory (about 100 KB) and performance.