1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Compression codecs for Kafka messages.
//!
//! Kafka supports pluggable compression at the message-set level. The
//! compression type is encoded in the lower 3 bits of the `attributes`
//! field in each [`Message`](crate::protocol::produce::MessageProduceRequest).
//!
//! This crate provides the following codecs, each gated behind a Cargo feature:
//!
//! | Codec | Attribute | Feature | Crate |
//! |--------|-----------|----------|------------|
//! | None | `0` | — | — |
//! | GZIP | `1` | `gzip` | `flate2` |
//! | Snappy | `2` | `snappy` | `snap` |
//! | LZ4 | `3` | `lz4` | `lz4_flex` |
//! | ZSTD | `4` | `zstd` | `zstd` |
//!
//! All features except `gzip` are enabled by default. To trim dependencies,
//! disable the default features and re-enable only what you need:
//!
//! ```toml
//! [dependencies]
//! rustfs-kafka = { version = "0.20", default-features = false, features = ["gzip"] }
//! ```
/// Compression types supported by Kafka.
///
/// The discriminant values correspond to the compression encoding in the
/// `attributes` field of a [`Message`](crate::protocol::produce::MessageProduceRequest)
/// in the Kafka wire protocol (lower 3 bits).
///
/// | Variant | Value | Kafka constant |
/// |---------|-------|---------------|
/// | `NONE` | 0 | `none` |
/// | `GZIP` | 1 | `gzip` |
/// | `SNAPPY`| 2 | `snappy` |
/// | `LZ4` | 3 | `lz4` |
/// | `ZSTD` | 4 | `zstd` |