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

Function read_column

nodedb/src/engine/timeseries/packed_partition.rs:337–350  ·  view source on GitHub ↗

Read a single column's data from a packed file using byte range. When `footer.payload_encrypted` is true, `kek` must be `Some`; the payload region (everything before the footer body) is decrypted first, then the column range is extracted from the plaintext. The NDPK footer itself is always plaintext.

(
    file_path: &Path,
    footer: &PackedFooter,
    column_name: &str,
    kek: Option<&WalEncryptionKey>,
)

Source from the content-addressed store, hash-verified

335/// column range is extracted from the plaintext. The NDPK footer itself is
336/// always plaintext.
337pub fn read_column(
338 file_path: &Path,
339 footer: &PackedFooter,
340 column_name: &str,
341 kek: Option<&WalEncryptionKey>,
342) -> Result<Vec<u8>, PackedError> {
343 let (offset, length) = footer
344 .column_ranges
345 .get(column_name)
346 .ok_or_else(|| PackedError::Corrupt(format!("column '{column_name}' not in footer")))?;
347
348 let data = std::fs::read(file_path).map_err(|e| PackedError::Io(format!("read: {e}")))?;
349 read_column_from_bytes(&data, footer, *offset, *length, kek)
350}
351
352/// Read a single column from in-memory file bytes (for testing).
353fn read_column_from_bytes(

Calls 3

read_column_from_bytesFunction · 0.85
readFunction · 0.50
getMethod · 0.45