Struct ConnectionBuilder

Source
pub struct ConnectionBuilder { /* private fields */ }
Expand description

Build connection to Tarantool.

Implementations§

Source§

impl ConnectionBuilder

Source

pub async fn build<A>(&self, addr: A) -> Result<Connection, Error>
where A: ToSocketAddrs + Display + Clone + Send + Sync + 'static,

Create connection to Tarantool using provided address.

Source

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.

Source

pub fn timeout(&mut self, timeout: impl Into<Option<Duration>>) -> &mut Self

Sets timeout for requests.

By default disabled.

Source

pub fn transaction_timeout( &mut self, transaction_timeout: impl Into<Option<Duration>>, ) -> &mut Self

Sets default timeout for transactions.

By default disabled.

Source

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).

Source

pub fn connect_timeout( &mut self, connect_timeout: impl Into<Option<Duration>>, ) -> &mut Self

Sets timeout for connect.

By default disabled.

Source

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).

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for ConnectionBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConnectionBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more