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

Function decode_bytes_pipeline

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

Decode raw bytes (symbol columns or string data) from a pipeline.

(data: &[u8], codec: ColumnCodec)

Source from the content-addressed store, hash-verified

190
191/// Decode raw bytes (symbol columns or string data) from a pipeline.
192pub fn decode_bytes_pipeline(data: &[u8], codec: ColumnCodec) -> Result<Vec<u8>, CodecError> {
193 match codec {
194 ColumnCodec::FsstLz4 => {
195 let fsst_bytes = crate::lz4::decode(data)?;
196 let strings = crate::fsst::decode(&fsst_bytes)?;
197 strings.into_iter().next().ok_or(CodecError::Corrupt {
198 detail: "FSST decode produced no output".into(),
199 })
200 }
201 ColumnCodec::FsstRans => {
202 let fsst_bytes = crate::rans::decode(data)?;
203 let strings = crate::fsst::decode(&fsst_bytes)?;
204 strings.into_iter().next().ok_or(CodecError::Corrupt {
205 detail: "FSST decode produced no output".into(),
206 })
207 }
208 ColumnCodec::Raw => crate::raw::decode(data),
209 ColumnCodec::Lz4 => crate::lz4::decode(data),
210 ColumnCodec::Zstd => crate::zstd_codec::decode(data),
211 ColumnCodec::FastLanesLz4 => {
212 let i64_vals = decode_fastlanes_lz4_i64(data)?;
213 Ok(i64_vals
214 .iter()
215 .flat_map(|&v| (v as u32).to_le_bytes())
216 .collect())
217 }
218 _ => crate::raw::decode(data).or_else(|_| Ok(data.to_vec())),
219 }
220}
221
222// ---------------------------------------------------------------------------
223// Cascading chain implementations

Callers 4

bytes_pipeline_roundtripFunction · 0.85
decode_blockFunction · 0.85
decode_columnFunction · 0.85
read_column_blocksMethod · 0.85

Calls 6

decode_fastlanes_lz4_i64Function · 0.85
collectMethod · 0.80
decodeFunction · 0.70
nextMethod · 0.45
iterMethod · 0.45
to_vecMethod · 0.45

Tested by 1

bytes_pipeline_roundtripFunction · 0.68