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

Function http_range_headers

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

Generate HTTP Range header values for fetching specific columns. Returns `(column_name, "bytes=offset-end")` pairs for use with S3 GetObject or HTTP range requests. Note: for encrypted packed files, these range headers address the ciphertext. Column-level reads require full payload decryption on the client side.

(footer: &PackedFooter, columns: &[&str])

Source from the content-addressed store, hash-verified

423/// ciphertext. Column-level reads require full payload decryption
424/// on the client side.
425pub fn http_range_headers(footer: &PackedFooter, columns: &[&str]) -> Vec<(String, String)> {
426 columns
427 .iter()
428 .filter_map(|&name| {
429 footer.column_ranges.get(name).map(|&(offset, length)| {
430 let end = offset + length - 1; // HTTP ranges are inclusive.
431 (name.to_string(), format!("bytes={offset}-{end}"))
432 })
433 })
434 .collect()
435}
436
437// ── Tests ─────────────────────────────────────────────────────────────────────
438

Calls 4

collectMethod · 0.80
to_stringMethod · 0.80
iterMethod · 0.45
getMethod · 0.45