Skip to main content

FileSpaceInfoMessage

Struct FileSpaceInfoMessage 

Source
pub struct FileSpaceInfoMessage {
    pub version: u8,
    pub strategy: FileSpaceStrategy,
    pub persist: bool,
    pub threshold: u64,
    pub page_size: u64,
    pub pgend_meta_thres: u16,
    pub eoa_pre_fsm_fsalloc: u64,
    pub fs_addr: Vec<u64>,
}
Expand description

File-space info message (0x0017) — H5Ofsinfo.c.

The version-0 form is the deprecated 1.10.0 encoding. Its four strategy values are mapped onto the version-1 strategy/persist/threshold fields on decode (H5O__fsinfo_decode), so every consumer of this struct sees one shape whatever the file carries.

What decode does not discard is which encoding the file used: version keeps it and encode re-emits at that version, so appending to a version-0 file leaves it a version-0 file. Upstream instead upgrades — H5O__fsinfo_encode has no version-0 branch, and H5F__super_read removes a mapped message and writes a version-1 replacement on read-write open (H5Fsuper.c:843-885) — which is a format change this crate has no reason to make on the user’s behalf, and which libhdf5 will still make on its own next open.

Fields§

§version: u8

The encoding this message uses on disk: 0 for the deprecated 1.10.0 form, 1 for the current one. Decode records what it read and encode writes that same form back; nothing else in the crate branches on it, because decode has already normalized the fields below.

§strategy: FileSpaceStrategy

File-space handling strategy.

§persist: bool

Whether free-space manager state is persisted across close/reopen.

§threshold: u64

Smallest free-space section tracked by a manager.

§page_size: u64

File-space page size (paged aggregation).

§pgend_meta_thres: u16

Page-end metadata threshold.

§eoa_pre_fsm_fsalloc: u64

End-of-address before free-space header/section allocation.

§fs_addr: Vec<u64>

Addresses of the free-space managers, indexed by FreeSpaceManager::message_slot.

Always FS_ADDR_COUNT_V1 entries, undefined where there is no manager — including for a non-persisting message, which stores none of them, and for a version-0 message, which stores only the first FS_ADDR_COUNT_V0. Upstream keeps the same full-width array for the same reason (H5O__fsinfo_decode fills all twelve with HADDR_UNDEF before reading any): a caller indexes a slot without first asking which encoding the slot came from.

Implementations§

Source§

impl FileSpaceInfoMessage

Source

pub fn decode(buf: &[u8], ctx: &FormatContext) -> FormatResult<Self>

Decode the message body.

Source

pub fn encode(&self, ctx: &FormatContext) -> FormatResult<Vec<u8>>

Encode the message body at the version it was decoded at (H5O__fsinfo_encode, plus the version-0 layout upstream only reads).

Fails only for a version-0 message carrying something that encoding cannot express, which decode cannot produce and only a caller that edited the message can reach — see encode_v0.

Source

pub fn encode_v0(&self, ctx: &FormatContext) -> FormatResult<Vec<u8>>

Encode the deprecated 1.10.0 body, the inverse of what H5O__fsinfo_decode’s version-0 branch reads.

Upstream has no such encoder: it decodes version 0, marks the message mapped, and rewrites it as version 1 on the next read-write open (H5Fsuper.c:866-880). This crate re-emits instead, so appending to a version-0 file does not silently change its on-disk format — but that is only sound while every field still fits, so the ones the encoding cannot hold are checked rather than assumed:

  • strategy/persist must be one of the four H5F_file_space_type_t combinations; paged aggregation postdates this encoding.
  • threshold is stored only for the two FSM_AGGR values; the other two are decoded as 1 and must still be 1.
  • the managers past the sixth must be undefined, there being no slot for them.

page_size, pgend_meta_thres and eoa_pre_fsm_fsalloc are not checked, because the version-0 encoding never carried them: decode synthesizes all three, and the next decode synthesizes them again from the same rule. Writing back the first two would be writing back constants; the third is re-derived from the file’s end of allocation, which is the value it would have anyway.

Trait Implementations§

Source§

impl Clone for FileSpaceInfoMessage

Source§

fn clone(&self) -> Self

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 FileSpaceInfoMessage

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for FileSpaceInfoMessage

Source§

impl PartialEq for FileSpaceInfoMessage

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileSpaceInfoMessage

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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.