pub struct SessionConfig {
Show 17 fields pub known_nodes: Vec<KnownNode>, pub compression: Option<Compression>, pub tcp_nodelay: bool, pub load_balancing: Arc<dyn LoadBalancingPolicy>, pub used_keyspace: Option<String>, pub keyspace_case_sensitive: bool, pub retry_policy: Box<dyn RetryPolicy>, pub speculative_execution_policy: Option<Arc<dyn SpeculativeExecutionPolicy>>, pub auth_username: Option<String>, pub auth_password: Option<String>, pub schema_agreement_interval: Duration, pub connect_timeout: Duration, pub connection_pool_size: PoolSize, pub disallow_shard_aware_port: bool, pub default_consistency: Consistency, pub fetch_schema_metadata: bool, pub keepalive_interval: Option<Duration>,
}
Expand description

Configuration options for Session. Can be created manually, but usually it’s easier to use SessionBuilder

Fields

known_nodes: Vec<KnownNode>

List of database servers known on Session startup. Session will connect to these nodes to retrieve information about other nodes in the cluster. Each node can be represented as a hostname or an IP address.

compression: Option<Compression>

Preferred compression algorithm to use on connections. If it’s not supported by database server Session will fall back to no compression.

tcp_nodelay: boolload_balancing: Arc<dyn LoadBalancingPolicy>

Load balancing policy used by Session

used_keyspace: Option<String>keyspace_case_sensitive: boolretry_policy: Box<dyn RetryPolicy>speculative_execution_policy: Option<Arc<dyn SpeculativeExecutionPolicy>>auth_username: Option<String>auth_password: Option<String>schema_agreement_interval: Durationconnect_timeout: Durationconnection_pool_size: PoolSize

Size of the per-node connection pool, i.e. how many connections the driver should keep to each node. The default is PerShard(1), which is the recommended setting for Scylla clusters.

disallow_shard_aware_port: bool

If true, prevents the driver from connecting to the shard-aware port, even if the node supports it. Generally, this options is best left as default (false).

default_consistency: Consistencyfetch_schema_metadata: bool

If true, full schema is fetched with every metadata refresh.

keepalive_interval: Option<Duration>

Interval of sending keepalive requests

Implementations

Creates a SessionConfig with default configuration

Default configuration
  • Compression: None
  • Load balancing policy: Token-aware Round-robin
Example
let config = SessionConfig::new();

Adds a known database server with a hostname. If the port is not explicitly specified, 9042 is used as default

Example
let mut config = SessionConfig::new();
config.add_known_node("127.0.0.1");
config.add_known_node("db1.example.com:9042");

Adds a known database server with an IP address

Example
let mut config = SessionConfig::new();
config.add_known_node_addr(SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 9042));

Adds a list of known database server with hostnames. If the port is not explicitly specified, 9042 is used as default

Example
let mut config = SessionConfig::new();
config.add_known_nodes(&["127.0.0.1:9042", "db1.example.com"]);

Adds a list of known database servers with IP addresses

Example
let addr1 = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(172, 17, 0, 3)), 9042);
let addr2 = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(172, 17, 0, 4)), 9042);

let mut config = SessionConfig::new();
config.add_known_nodes_addr(&[addr1, addr2]);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Creates default SessionConfig, same as SessionConfig::new

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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