Module cdrs::compression [−][src]
CDRS support traffic decompression as it is described in Apache Cassandra protocol
Before being used, client and server must agree on a compression algorithm to use, which is done in the STARTUP message. As a consequence, a STARTUP message must never be compressed. However, once the STARTUP frame has been received by the server, messages can be compressed (including the response to the STARTUP request).
use cdrs::cluster::Cluster; use cdrs::authenticators::NoneAuthenticator; use cdrs::load_balancing::RoundRobin; const _ADDR: &'static str = "127.0.0.1:9042"; let cluster = Cluster::new(vec![_ADDR], NoneAuthenticator {}); let mut no_compression = cluster.connect(RoundRobin::new()) .expect("No compression connection error"); let mut lz4_compression = cluster.connect_lz4(RoundRobin::new()) .expect("LZ4 compression connection error"); let mut snappy_compression = cluster.connect_snappy(RoundRobin::new()) .expect("Snappy compression connection error");
Enums
Compression |
Enum which represents a type of compression. Only non-startup frame's body can be compressen. |
CompressionError |
It's an error which may occure during encoding or deconding frame body. As there are only two types of compressors it contains two related enum options. |
Constants
LZ4 | |
SNAPPY |
Traits
Compressor |
Compressor trait that defines functionality which should be provided by typical compressor. |