verify_dataset existed and was tested, but was only ever called from clawhdf5-format's own test files — no reader path in clawhdf5-io or the clawhdf5 facade called it, so a corrupted dataset was silently readable even though the write-side SHA-256 hash machinery (gated on the provenance feature) had already written what it needed to detect that. Add Dataset::verify_provenance() to the clawhdf5 facade, gated behind a new `provenance` feature (on by default, forwarding to clawhdf5-format/provenance which is already default-on). It surfaces a typed VerifyResult (Ok/Mismatch/NoHash) via the existing Error type rather than panicking. Deliberately NOT called automatically on open()/dataset() — it decodes and hashes the entire dataset, which would regress every read path (including the zero-copy/mmap ones) if run unconditionally; callers opt in per dataset where the cost is acceptable (e.g. a periodic integrity sweep). Also re-export clawhdf5_format::provenance from the facade crate so VerifyResult is reachable without depending on clawhdf5-format directly. INT-08
50 lines
1.6 KiB
TOML
50 lines
1.6 KiB
TOML
[package]
|
|
name = "clawhdf5"
|
|
version = "2.1.0"
|
|
edition = "2024"
|
|
description = "Pure-Rust HDF5 reader/writer — no C dependencies"
|
|
license = "MIT"
|
|
repository = "https://github.com/redclawsystems/clawhdf5"
|
|
readme = "README.md"
|
|
keywords = ["hdf5", "science", "data", "binary"]
|
|
categories = ["parser-implementations", "science", "encoding"]
|
|
|
|
[dependencies]
|
|
clawhdf5-format = { path = "../clawhdf5-format", version = "2.1.0" }
|
|
clawhdf5-io = { path = "../clawhdf5-io", version = "2.1.0" }
|
|
rayon = { version = "1", optional = true }
|
|
|
|
[dev-dependencies]
|
|
tempfile = { workspace = true }
|
|
criterion = { workspace = true }
|
|
clawhdf5-io = { path = "../clawhdf5-io", version = "2.1.0", features = ["mmap"] }
|
|
clawhdf5-format = { path = "../clawhdf5-format", version = "2.1.0", features = ["parallel", "fast-checksum"] }
|
|
clawhdf5-filters = { path = "../clawhdf5-filters", version = "2.1.0" }
|
|
|
|
[[bench]]
|
|
name = "mmap_bench"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "parallel_bench"
|
|
harness = false
|
|
|
|
[features]
|
|
default = ["mmap", "fast-deflate", "provenance"]
|
|
mmap = ["clawhdf5-io/mmap"]
|
|
parallel = ["clawhdf5-format/parallel", "rayon"]
|
|
fast-deflate = ["clawhdf5-format/fast-deflate"]
|
|
apple-compression = []
|
|
zstd = ["clawhdf5-format/zstd"]
|
|
blake3_hash = ["clawhdf5-format/blake3_hash"]
|
|
lz4 = ["clawhdf5-format/lz4"]
|
|
pcodec = ["clawhdf5-format/pcodec"]
|
|
# Dataset::verify_provenance() — recompute a dataset's SHA-256 and compare
|
|
# against its stored _provenance_sha256 attribute. On by default, matching
|
|
# clawhdf5-format's own default-on `provenance` feature.
|
|
provenance = ["clawhdf5-format/provenance"]
|
|
|
|
[package.metadata.docs.rs]
|
|
features = ["mmap"]
|
|
targets = ["x86_64-unknown-linux-gnu"]
|