pub struct ClientPolicy {
    pub user_password: Option<(String, String)>,
    pub timeout: Option<Duration>,
    pub idle_timeout: Option<Duration>,
    pub max_conns_per_node: usize,
    pub conn_pools_per_node: usize,
    pub fail_if_not_connected: bool,
    pub buffer_reclaim_threshold: usize,
    pub tend_interval: Duration,
    pub ip_map: Option<HashMap<String, String>>,
    pub use_services_alternate: bool,
    pub thread_pool_size: usize,
    pub cluster_name: Option<String>,
}
Expand description

ClientPolicy encapsulates parameters for client policy command.

Fields§

§user_password: Option<(String, String)>

User authentication to cluster. Leave empty for clusters running without restricted access.

§timeout: Option<Duration>

Initial host connection timeout in milliseconds. The timeout when opening a connection to the server host for the first time.

§idle_timeout: Option<Duration>

Connection idle timeout. Every time a connection is used, its idle deadline will be extended by this duration. When this deadline is reached, the connection will be closed and discarded from the connection pool.

§max_conns_per_node: usize

Maximum number of synchronous connections allowed per server node.

§conn_pools_per_node: usize

Number of connection pools used for each node. Machines with 8 CPU cores or less usually need only one connection pool per node. Machines with larger number of CPU cores may have their performance limited by contention for pooled connections. Contention for pooled connections can be reduced by creating multiple mini connection pools per node.

§fail_if_not_connected: bool

Throw exception if host connection fails during addHost().

§buffer_reclaim_threshold: usize

Threshold at which the buffer attached to the connection will be shrunk by deallocating memory instead of just resetting the size of the underlying vec. Should be set to a value that covers as large a percentile of payload sizes as possible, while also being small enough not to occupy a significant amount of memory for the life of the connection pool.

§tend_interval: Duration

TendInterval determines interval for checking for cluster state changes. Minimum possible interval is 10 Milliseconds.

§ip_map: Option<HashMap<String, String>>

A IP translation table is used in cases where different clients use different server IP addresses. This may be necessary when using clients from both inside and outside a local area network. Default is no translation. The key is the IP address returned from friend info requests to other servers. The value is the real IP address used to connect to the server.

§use_services_alternate: bool

UseServicesAlternate determines if the client should use “services-alternate” instead of “services” in info request during cluster tending. “services-alternate” returns server configured external IP addresses that client uses to talk to nodes. “services-alternate” can be used in place of providing a client “ipMap”. This feature is recommended instead of using the client-side IpMap above.

“services-alternate” is available with Aerospike Server versions >= 3.7.1.

§thread_pool_size: usize

Size of the thread pool used in scan and query commands. These commands are often sent to multiple server nodes in parallel threads. A thread pool improves performance because threads do not have to be created/destroyed for each command.

§cluster_name: Option<String>

Expected cluster name. It not None, server nodes must return this cluster name in order to join the client’s view of the cluster. Should only be set when connecting to servers that support the “cluster-name” info command.

Implementations§

source§

impl ClientPolicy

source

pub fn set_user_password( &mut self, username: String, password: String ) -> Result<()>

Set username and password to use when authenticating to the cluster.

Trait Implementations§

source§

impl Clone for ClientPolicy

source§

fn clone(&self) -> ClientPolicy

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ClientPolicy

source§

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

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

impl Default for ClientPolicy

source§

fn default() -> ClientPolicy

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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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, U> Into<U> for Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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

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

§

fn vzip(self) -> V