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

Function encode_i64_pipeline

nodedb-codec/src/pipeline.rs:27–56  ·  view source on GitHub ↗

Encode i64 values through a cascading pipeline. For cascading codecs, chains the appropriate stages. For legacy codecs, delegates to the single-step encoder.

(values: &[i64], codec: ColumnCodec)

Source from the content-addressed store, hash-verified

25/// For cascading codecs, chains the appropriate stages. For legacy codecs,
26/// delegates to the single-step encoder.
27pub fn encode_i64_pipeline(values: &[i64], codec: ColumnCodec) -> Result<Vec<u8>, CodecError> {
28 match codec {
29 // Cascading chains — lz4 terminal.
30 ColumnCodec::DeltaFastLanesLz4 => encode_delta_fastlanes_lz4(values),
31 ColumnCodec::FastLanesLz4 => encode_fastlanes_lz4_i64(values),
32 ColumnCodec::PcodecLz4 => {
33 let pco_bytes = crate::pcodec::encode_i64(values)?;
34 Ok(crate::lz4::encode(&pco_bytes))
35 }
36 // Cascading chains — rANS terminal (cold tier).
37 ColumnCodec::DeltaFastLanesRans => encode_delta_fastlanes_rans(values),
38 // Single-step codecs (small partitions / non-ALP-encodable data).
39 ColumnCodec::DoubleDelta => Ok(crate::double_delta::encode(values)),
40 ColumnCodec::Delta => Ok(crate::delta::encode(values)),
41 ColumnCodec::Gorilla => Ok(crate::gorilla::encode_timestamps(values)),
42 ColumnCodec::Raw => {
43 let raw: Vec<u8> = values.iter().flat_map(|v| v.to_le_bytes()).collect();
44 Ok(crate::raw::encode(&raw))
45 }
46 ColumnCodec::Lz4 => {
47 let raw: Vec<u8> = values.iter().flat_map(|v| v.to_le_bytes()).collect();
48 Ok(crate::lz4::encode(&raw))
49 }
50 ColumnCodec::Zstd => {
51 let raw: Vec<u8> = values.iter().flat_map(|v| v.to_le_bytes()).collect();
52 crate::zstd_codec::encode(&raw)
53 }
54 _ => Ok(crate::delta::encode(values)),
55 }
56}
57
58/// Encode f64 values through a cascading pipeline.
59pub fn encode_f64_pipeline(values: &[f64], codec: ColumnCodec) -> Result<Vec<u8>, CodecError> {

Callers 9

fastlanes_lz4_symbol_idsFunction · 0.85
legacy_codecs_still_workFunction · 0.85
empty_valuesFunction · 0.85
encode_i64_with_validityFunction · 0.85
encode_single_blockFunction · 0.85
encode_columnFunction · 0.85

Calls 8

encode_fastlanes_lz4_i64Function · 0.85
encode_i64Function · 0.85
encode_timestampsFunction · 0.85
collectMethod · 0.80
encodeFunction · 0.70
iterMethod · 0.45

Tested by 6

fastlanes_lz4_symbol_idsFunction · 0.68
legacy_codecs_still_workFunction · 0.68
empty_valuesFunction · 0.68