vector_common/constants.rs
1pub const GZIP_MAGIC: &[u8] = &[0x1f, 0x8b];
2pub const ZLIB_MAGIC: &[u8] = &[0x78];
3pub const ZSTD_MAGIC: &[u8] = &[0x28, 0xB5, 0x2F, 0xFD];
4
5/// Maximum size of a zlib stored (uncompressed) block in bytes.
6/// See: <https://www.zlib.net/zlib_tech.html>
7pub const ZLIB_STORED_BLOCK_SIZE: usize = 16384;
8
9/// Per-block overhead for zlib stored blocks: 1-byte header + 2-byte length + 2-byte ~length.
10/// See: <https://www.zlib.net/zlib_tech.html>
11pub const ZLIB_STORED_BLOCK_OVERHEAD: usize = 5;
12
13/// Zlib frame overhead: 2-byte header + 4-byte Adler-32 checksum trailer.
14/// See: <https://www.zlib.net/zlib_tech.html>
15pub const ZLIB_FRAME_OVERHEAD: usize = 6;
16
17/// Threshold below which zstd's `ZSTD_compressBound` adds extra margin (128 KiB).
18/// See: <https://github.com/facebook/zstd/blob/dev/lib/zstd.h> (`ZSTD_compressBound`)
19pub const ZSTD_SMALL_INPUT_THRESHOLD: usize = 128 << 10;