Skip to main content

Hdf5File

Struct Hdf5File 

Source
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: String

Virtual filename.

§root: Hdf5Group

Root group (“/”).

§superblock: Hdf5Superblock

Simulated superblock.

§named_types: NamedDatatypeRegistry

Named (committed) datatype registry.

§lock_state: LockState

Current file lock state.

§parallel_meta: Option<ParallelHdf5Meta>

Optional parallel write metadata.

§write_tick: u64

Simulation clock tick (incremented on each write).

Implementations§

Source§

impl Hdf5File

Source

pub fn new(filename: &str) -> Self

Create a new empty in-memory HDF5 file.

Source

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.

Source

pub fn unlock(&mut self)

Release the write lock.

Source

pub fn lock_read(&mut self) -> Hdf5Result<()>

Acquire a shared read lock (multiple readers allowed).

Source

pub fn is_locked(&self) -> bool

Return true if the file is write-locked.

Source

pub fn update_eof(&mut self, new_eof: u64)

Simulate updating the superblock’s EOF address after a write.

Source

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).

Source

pub fn open_group(&self, path: &str) -> Hdf5Result<&Hdf5Group>

Return a shared reference to the group at path.

Source

pub fn open_group_mut(&mut self, path: &str) -> Hdf5Result<&mut Hdf5Group>

Return a mutable reference to the group at path.

Source

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.

Source

pub fn open_dataset( &self, group_path: &str, name: &str, ) -> Hdf5Result<&Hdf5Dataset>

Return a shared reference to a dataset at group_path/dataset_name.

Source

pub fn open_dataset_mut( &mut self, group_path: &str, name: &str, ) -> Hdf5Result<&mut Hdf5Dataset>

Return a mutable reference to a dataset.

Source

pub fn set_dataset_attr( &mut self, group_path: &str, dataset: &str, attr_name: &str, value: AttrValue, ) -> Hdf5Result<()>

Set an attribute on a dataset.

Source

pub fn get_dataset_attr( &self, group_path: &str, dataset: &str, attr_name: &str, ) -> Hdf5Result<&AttrValue>

Get an attribute from a dataset.

Source

pub fn commit_datatype( &mut self, name: &str, dtype: Hdf5Dtype, ) -> Hdf5Result<()>

Register a named (committed) datatype.

Source

pub fn find_named_type(&self, name: &str) -> Hdf5Result<&Hdf5Dtype>

Look up a named datatype.

Create a soft link inside group_path.

Create a hard link inside group_path.

Source

pub fn init_parallel(&mut self, n_ranks: usize)

Attach parallel HDF5 metadata for an N-rank job.

Source

pub fn record_rank_bytes(&mut self, rank: usize, bytes: u64)

Record bytes written by MPI rank rank.

Trait Implementations§

Source§

impl Clone for Hdf5File

Source§

fn clone(&self) -> Hdf5File

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Hdf5File

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.