[][src]Struct reool::config::Config

pub struct Config {
    pub desired_pool_size: usize,
    pub default_checkout_mode: DefaultPoolCheckoutMode,
    pub backoff_strategy: BackoffStrategy,
    pub reservation_limit: usize,
    pub activation_order: ActivationOrder,
    pub min_required_nodes: usize,
    pub connect_to_nodes: Vec<String>,
    pub pool_multiplier: u32,
    pub checkout_queue_size: usize,
    pub retry_on_checkout_limit: bool,
    pub default_command_timeout: DefaultCommandTimeout,
}

A configuration for creating a RedisPool.

Fields

desired_pool_size: usize

The number of connections a pool should have. If a pool with multiple sub pools is created, this value applies to each sub pool.

The default is 50.

default_checkout_mode: DefaultPoolCheckoutMode

The timeout for a checkout if no specific timeout is given with a checkout.

backoff_strategy: BackoffStrategy

The BackoffStrategy to use when retrying on failures to create new connections

reservation_limit: usize

The maximum length of the queue for waiting checkouts when no idle connections are available. If a pool with multiple sub pools is created, this value applies to each sub pool.

The default is 50.

activation_order: ActivationOrder

Defines the ActivationOrder in which idle connections are activated.

Default is ActivationOrder::FiFo

min_required_nodes: usize

The minimum required nodes to start

connect_to_nodes: Vec<String>

The nodes to connect to.

pool_multiplier: u32

When the pool is created this is a multiplier for the amount of sub pools to be created.

Other values will be adjusted if the multiplier is > 1:

  • reservation_limit: Stays zero if zero, otherwise (reservation_limit/multiplier) +1
  • desired_pool_size: desired_pool_size/multiplier) +1
checkout_queue_size: usize

The number of checkouts that can be enqueued. If a pool with multiple sub pools is created, this value applies to each sub pool.

The default is 100.

retry_on_checkout_limit: bool

Set to true if a retry on a checkout should be made if the queue was full. Otherwise do not retry.

The default is true.

default_command_timeout: DefaultCommandTimeout

A timeout for commands which is applied to all commands on all connections.

Implementations

impl Config[src]

pub fn desired_pool_size(self, v: usize) -> Self[src]

The number of connections a pool should have. If a pool with multiple sub pools is created, this value applies to each sub pool.

The default is 50.

pub fn default_checkout_mode<T: Into<DefaultPoolCheckoutMode>>(
    self,
    v: T
) -> Self
[src]

Sets the behaviour of the pool on checkouts if no specific behaviour was requested by the user.

pub fn backoff_strategy(self, v: BackoffStrategy) -> Self[src]

Sets the BackoffStrategy to use when retrying on failures to create new connections

pub fn reservation_limit(self, v: usize) -> Self[src]

The maximum length of the queue for waiting checkouts when no idle connections are available. If a pool with multiple sub pools is created, this value applies to each sub pool.

The default is 50.

pub fn activation_order(self, v: ActivationOrder) -> Self[src]

Defines the ActivationOrder in which idle connections are activated.

Default is ActivationOrder::FiFo

pub fn min_required_nodes(self, v: usize) -> Self[src]

Sets the maximum length of the queue for waiting checkouts when no idle connections are available

pub fn connect_to_nodes(self, v: Vec<String>) -> Self[src]

The Redis nodes to connect to

pub fn connect_to_node<T: Into<String>>(self, v: T) -> Self[src]

The Redis node to connect to

pub fn checkout_queue_size(self, v: usize) -> Self[src]

The number of checkouts that can be enqueued. If a pool with multiple sub pools is created, this value applies to each sub pool.

The default is 100.

pub fn retry_on_checkout_limit(self, v: bool) -> Self[src]

Set to true if a retry on a checkout should be made if the queue was full. Otherwise do not retry.

The default is true.

pub fn pool_multiplier(self, v: u32) -> Self[src]

When the pool is created this is a multiplier for the amount of sub pools to be created.

Other values will be adjusted if the multiplier is > 1:

  • reservation_limit: Stays zero if zero, otherwise (reservation_limit/multiplier) +1
  • desired_pool_size: desired_pool_size/multiplier) +1

pub fn default_command_timeout<T: Into<DefaultCommandTimeout>>(
    self,
    v: T
) -> Self
[src]

A timeout for commands which is applied to all commands on all connections.

pub fn update_from_environment(
    &mut self,
    prefix: Option<&str>
) -> InitializationResult<()>
[src]

Updates this configuration from the environment.

If no prefix is set all the given env key start with REOOL_. Otherwise the prefix is used with an automatically appended _.

  • DESIRED_POOL_SIZE: usize. Omit if you do not want to update the value
  • DEFAULT_POOL_CHECKOUT_MODE: The default checkout mode to use. Omit if you do not want to update the value
  • RESERVATION_LIMIT: usize. Omit if you do not want to update the value
  • ACTIVATION_ORDER: string. Omit if you do not want to update the value
  • MIN_REQUIRED_NODES: usize. Omit if you do not want to update the value
  • CONNECT_TO: [String]. Separated by ;. Omit if you do not want to update the value
  • POOL_MULTIPLIER: Omit if you do not want to update the value
  • CHECKOUT_QUEUE_SIZE: Omit if you do not want to update the value
  • RETRY_ON_CHECKOUT_LIMIT: Omit if you do not want to update the value
  • DEFAULT_COMMAND_TIMEOUT_MS: Omit if you do not want to update the value

pub fn builder(&self) -> Builder[src]

Create a Builder initialized with the values from this Config

Trait Implementations

impl Clone for Config[src]

impl Debug for Config[src]

impl Default for Config[src]

Auto Trait Implementations

impl RefUnwindSafe for Config

impl Send for Config

impl Sync for Config

impl Unpin for Config

impl UnwindSafe for Config

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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