Chunked reads beat an h5py process pool; unlimited writer B-trees; Blosc2; 599/697 conformance #16
@@ -712,18 +712,35 @@ fn main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// libhdf5 decodes the superblock extension at open, and loads a
|
// libhdf5 decodes the superblock extension at open (File::open does
|
||||||
// metadata cache image over the file's own metadata.
|
// the same), and loads a metadata cache image over the file's own
|
||||||
let view = match guarded(|| {
|
// metadata. It loads the image only when it first reads metadata — the
|
||||||
clawhdf5_format::superblock_ext::metadata_view(hdf5, &sb).map_err(e)
|
// root group — so a file whose image it cannot load still opens and
|
||||||
}) {
|
// every object fails; File::open refuses such a file outright. The
|
||||||
Ok(v) => v,
|
// probe records the image's error where libhdf5 reports it.
|
||||||
|
use clawhdf5_format::superblock_ext;
|
||||||
|
let ext = match guarded(|| superblock_ext::read_superblock_extension(hdf5, &sb).map_err(e)) {
|
||||||
|
Ok(x) => x,
|
||||||
Err(msg) => {
|
Err(msg) => {
|
||||||
top.insert("open_error".into(), Value::String(msg));
|
top.insert("open_error".into(), Value::String(msg));
|
||||||
println!("{}", Value::Object(top));
|
println!("{}", Value::Object(top));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let mut image_error = None;
|
||||||
|
let view = match ext.and_then(|x| x.cache_image) {
|
||||||
|
None => None,
|
||||||
|
Some(loc) => match guarded(|| {
|
||||||
|
superblock_ext::apply_cache_image(hdf5, loc, sb.offset_size, sb.length_size)
|
||||||
|
.map_err(e)
|
||||||
|
}) {
|
||||||
|
Ok(v) => Some(v),
|
||||||
|
Err(msg) => {
|
||||||
|
image_error = Some(msg);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
let hdf5: &[u8] = view.as_deref().unwrap_or(hdf5);
|
let hdf5: &[u8] = view.as_deref().unwrap_or(hdf5);
|
||||||
top.insert("superblock_version".into(), json!(sb.version));
|
top.insert("superblock_version".into(), json!(sb.version));
|
||||||
let ctx = Ctx {
|
let ctx = Ctx {
|
||||||
@@ -752,6 +769,9 @@ fn main() {
|
|||||||
let mut rec = Map::new();
|
let mut rec = Map::new();
|
||||||
rec.insert("path".into(), Value::String(p.clone()));
|
rec.insert("path".into(), Value::String(p.clone()));
|
||||||
let r = guarded(|| {
|
let r = guarded(|| {
|
||||||
|
if let Some(msg) = &image_error {
|
||||||
|
return Err(msg.clone());
|
||||||
|
}
|
||||||
let h = ctx.header(addr)?;
|
let h = ctx.header(addr)?;
|
||||||
Ok(h)
|
Ok(h)
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user