pub struct Hdf5File {
pub filename: String,
pub root: Hdf5Group,
pub superblock: Hdf5Superblock,
pub named_types: NamedDatatypeRegistry,
pub lock_state: LockState,
pub parallel_meta: Option<ParallelHdf5Meta>,
pub write_tick: u64,
}Expand description
Top-level HDF5 mock file containing a group hierarchy, named-type registry and file-level metadata.
Fields§
§filename: StringVirtual filename.
root: Hdf5GroupRoot group (“/”).
superblock: Hdf5SuperblockSimulated superblock.
named_types: NamedDatatypeRegistryNamed (committed) datatype registry.
lock_state: LockStateCurrent file lock state.
parallel_meta: Option<ParallelHdf5Meta>Optional parallel write metadata.
write_tick: u64Simulation clock tick (incremented on each write).
Implementations§
Source§impl Hdf5File
impl Hdf5File
Sourcepub fn lock_write(&mut self, owner_id: u64) -> Hdf5Result<()>
pub fn lock_write(&mut self, owner_id: u64) -> Hdf5Result<()>
Acquire an exclusive write lock (simulated).
Returns Err(Hdf5Error::FileLocked) if the file is already locked.
Sourcepub fn lock_read(&mut self) -> Hdf5Result<()>
pub fn lock_read(&mut self) -> Hdf5Result<()>
Acquire a shared read lock (multiple readers allowed).
Sourcepub fn update_eof(&mut self, new_eof: u64)
pub fn update_eof(&mut self, new_eof: u64)
Simulate updating the superblock’s EOF address after a write.
Sourcepub fn create_group(&mut self, path: &str) -> Hdf5Result<()>
pub fn create_group(&mut self, path: &str) -> Hdf5Result<()>
Create a group at the given slash-separated path (relative to root).
Intermediate groups are created as needed (like mkdir -p).
Sourcepub fn open_group(&self, path: &str) -> Hdf5Result<&Hdf5Group>
pub fn open_group(&self, path: &str) -> Hdf5Result<&Hdf5Group>
Return a shared reference to the group at path.
Sourcepub fn open_group_mut(&mut self, path: &str) -> Hdf5Result<&mut Hdf5Group>
pub fn open_group_mut(&mut self, path: &str) -> Hdf5Result<&mut Hdf5Group>
Return a mutable reference to the group at path.
Sourcepub fn create_dataset(
&mut self,
group_path: &str,
name: &str,
shape: Vec<usize>,
dtype: Hdf5Dtype,
) -> Hdf5Result<()>
pub fn create_dataset( &mut self, group_path: &str, name: &str, shape: Vec<usize>, dtype: Hdf5Dtype, ) -> Hdf5Result<()>
Create a dataset at group_path/dataset_name.
Sourcepub fn open_dataset(
&self,
group_path: &str,
name: &str,
) -> Hdf5Result<&Hdf5Dataset>
pub fn open_dataset( &self, group_path: &str, name: &str, ) -> Hdf5Result<&Hdf5Dataset>
Return a shared reference to a dataset at group_path/dataset_name.
Sourcepub fn open_dataset_mut(
&mut self,
group_path: &str,
name: &str,
) -> Hdf5Result<&mut Hdf5Dataset>
pub fn open_dataset_mut( &mut self, group_path: &str, name: &str, ) -> Hdf5Result<&mut Hdf5Dataset>
Return a mutable reference to a dataset.
Sourcepub fn set_dataset_attr(
&mut self,
group_path: &str,
dataset: &str,
attr_name: &str,
value: AttrValue,
) -> Hdf5Result<()>
pub fn set_dataset_attr( &mut self, group_path: &str, dataset: &str, attr_name: &str, value: AttrValue, ) -> Hdf5Result<()>
Set an attribute on a dataset.
Sourcepub fn get_dataset_attr(
&self,
group_path: &str,
dataset: &str,
attr_name: &str,
) -> Hdf5Result<&AttrValue>
pub fn get_dataset_attr( &self, group_path: &str, dataset: &str, attr_name: &str, ) -> Hdf5Result<&AttrValue>
Get an attribute from a dataset.
Sourcepub fn commit_datatype(
&mut self,
name: &str,
dtype: Hdf5Dtype,
) -> Hdf5Result<()>
pub fn commit_datatype( &mut self, name: &str, dtype: Hdf5Dtype, ) -> Hdf5Result<()>
Register a named (committed) datatype.
Sourcepub fn find_named_type(&self, name: &str) -> Hdf5Result<&Hdf5Dtype>
pub fn find_named_type(&self, name: &str) -> Hdf5Result<&Hdf5Dtype>
Look up a named datatype.
Sourcepub fn create_soft_link(
&mut self,
group_path: &str,
link_name: &str,
target: &str,
) -> Hdf5Result<()>
pub fn create_soft_link( &mut self, group_path: &str, link_name: &str, target: &str, ) -> Hdf5Result<()>
Create a soft link inside group_path.
Sourcepub fn create_hard_link(
&mut self,
group_path: &str,
link_name: &str,
target: &str,
) -> Hdf5Result<()>
pub fn create_hard_link( &mut self, group_path: &str, link_name: &str, target: &str, ) -> Hdf5Result<()>
Create a hard link inside group_path.
Sourcepub fn init_parallel(&mut self, n_ranks: usize)
pub fn init_parallel(&mut self, n_ranks: usize)
Attach parallel HDF5 metadata for an N-rank job.
Sourcepub fn record_rank_bytes(&mut self, rank: usize, bytes: u64)
pub fn record_rank_bytes(&mut self, rank: usize, bytes: u64)
Record bytes written by MPI rank rank.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Hdf5File
impl RefUnwindSafe for Hdf5File
impl Send for Hdf5File
impl Sync for Hdf5File
impl Unpin for Hdf5File
impl UnsafeUnpin for Hdf5File
impl UnwindSafe for Hdf5File
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.