An internal node's child pointer is an address, the child's record count and (below the first internal level) the child subtree's total record count. libhdf5 (H5B2__hdr_init) encodes the record count in the width of a leaf's maximum and the subtree total in the width of cum_max_nrec for that depth, computed level by level from the node size. The reader guessed 2 * leaf_max and leaf_max^depth, which agree at depth 2 but not at depth 3: a 24 000-link group's name index has depth 3, its root's pointers were read 3 bytes wide instead of 2, and listing failed with a garbage heap offset. Regression tests: dense_group_with_a_three_level_name_index (h5py writes 24 000 links; listing compared with h5py) and subtree_capacity_matches_libhdf5. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
clawhdf5-format
Pure-Rust HDF5 binary format parsing and writing — no C dependencies.
Features
- Zero-copy superblock, object header, and B-tree parsing
- Chunked dataset read/write with filter pipelines
no_stdsupport (disablestdfeature)- Optional parallel reads via Rayon
- SHA-256 provenance tracking
Usage
use clawhdf5_format::Superblock;
let data = std::fs::read("data.h5").unwrap();
let sb = Superblock::from_bytes(&data).unwrap();
println!("HDF5 version {}.{}", sb.version_major(), sb.version_minor());
License
MIT