MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / encode

Function encode

nodedb-codec/src/zstd_codec.rs:38–40  ·  view source on GitHub ↗

Compress raw bytes using Zstd at the default level (3).

(data: &[u8])

Source from the content-addressed store, hash-verified

36
37/// Compress raw bytes using Zstd at the default level (3).
38pub fn encode(data: &[u8]) -> Result<Vec<u8>, CodecError> {
39 encode_with_level(data, DEFAULT_LEVEL)
40}
41
42/// Compress raw bytes using Zstd at a specific level (1-22).
43pub fn encode_with_level(data: &[u8], level: i32) -> Result<Vec<u8>, CodecError> {

Callers 5

empty_dataFunction · 0.70
small_data_roundtripFunction · 0.70
large_data_roundtripFunction · 0.70
high_compression_levelFunction · 0.70
better_ratio_than_lz4Function · 0.70

Calls 1

encode_with_levelFunction · 0.85

Tested by 5

empty_dataFunction · 0.56
small_data_roundtripFunction · 0.56
large_data_roundtripFunction · 0.56
high_compression_levelFunction · 0.56
better_ratio_than_lz4Function · 0.56