pub struct HDF5File { /* private fields */ }Expand description
An opened HDF5 file.
This is the main entry point for reading HDF5 metadata. It holds a reference to the async reader and the parsed superblock.
§Example
use async_hdf5::HDF5File;
use async_hdf5::reader::ObjectReader;
let reader = ObjectReader::new(store, path);
let file = HDF5File::open(reader).await?;
let root = file.root_group_header().await?;Implementations§
Source§impl HDF5File
impl HDF5File
Sourcepub async fn open(reader: impl AsyncFileReader) -> Result<Self>
pub async fn open(reader: impl AsyncFileReader) -> Result<Self>
Open an HDF5 file by parsing its superblock.
Wraps the given reader in a BlockCache (default 8 MiB blocks) to
coalesce the many small metadata reads into a few large requests.
Sourcepub async fn open_with_block_size(
reader: impl AsyncFileReader,
block_size: u64,
) -> Result<Self>
pub async fn open_with_block_size( reader: impl AsyncFileReader, block_size: u64, ) -> Result<Self>
Open with a configurable block cache size.
Sourcepub async fn open_with_options(
reader: impl AsyncFileReader,
block_size: u64,
pre_warm_threshold: Option<u64>,
) -> Result<Self>
pub async fn open_with_options( reader: impl AsyncFileReader, block_size: u64, pre_warm_threshold: Option<u64>, ) -> Result<Self>
Open with configurable block cache size and optional pre-warming.
If pre_warm_threshold is Some(n), the file size is queried via
AsyncFileReader::file_size() and up to n bytes of cache blocks
are fetched in parallel before returning. For files smaller than n,
every block is fetched. For larger files, the first n bytes worth
of blocks are fetched (HDF5 metadata is typically concentrated near
the start of the file). This eliminates sequential cache misses
during B-tree / object-header traversal.
Sourcepub async fn open_raw(reader: Arc<dyn AsyncFileReader>) -> Result<Self>
pub async fn open_raw(reader: Arc<dyn AsyncFileReader>) -> Result<Self>
Open with an already-configured reader (e.g., a pre-built BlockCache).
Note: raw_reader is set to the same reader. If you need batch chunk
fetches to bypass a cache layer, use open or open_with_block_size.
Sourcepub fn superblock(&self) -> &Superblock
pub fn superblock(&self) -> &Superblock
Access the parsed superblock.
Sourcepub fn reader(&self) -> &Arc<dyn AsyncFileReader>
pub fn reader(&self) -> &Arc<dyn AsyncFileReader>
Access the underlying async reader.
Sourcepub async fn read_object_header(&self, address: u64) -> Result<ObjectHeader>
pub async fn read_object_header(&self, address: u64) -> Result<ObjectHeader>
Read and parse the object header at the given file address.
Sourcepub async fn root_group_header(&self) -> Result<ObjectHeader>
pub async fn root_group_header(&self) -> Result<ObjectHeader>
Read the root group’s object header.
Sourcepub fn raw_reader(&self) -> &Arc<dyn AsyncFileReader>
pub fn raw_reader(&self) -> &Arc<dyn AsyncFileReader>
Access the raw (uncached) reader for direct byte-range fetches.
Sourcepub async fn root_group(&self) -> Result<HDF5Group>
pub async fn root_group(&self) -> Result<HDF5Group>
Get the root group as an HDF5Group for navigation.