Struct scylla::transport::session::SessionConfig [−][src]
pub struct SessionConfig { 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, }
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: bool
load_balancing: Arc<dyn LoadBalancingPolicy>
Load balancing policy used by Session
used_keyspace: Option<String>
keyspace_case_sensitive: bool
retry_policy: Box<dyn RetryPolicy>
speculative_execution_policy: Option<Arc<dyn SpeculativeExecutionPolicy>>
auth_username: Option<String>
auth_password: Option<String>
schema_agreement_interval: Duration
connect_timeout: Duration
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
Creates default SessionConfig
, same as SessionConfig::new
Auto Trait Implementations
impl !RefUnwindSafe for SessionConfig
impl Send for SessionConfig
impl Sync for SessionConfig
impl Unpin for SessionConfig
impl !UnwindSafe for SessionConfig
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V