pub enum DataLayoutMessage {
Contiguous {
address: u64,
size: u64,
},
Compact {
data: Vec<u8>,
},
ChunkedV3 {
chunk_dims: Vec<u64>,
b_tree_address: u64,
},
ChunkedV4 {
version: u8,
flags: u8,
chunk_dims: Vec<u64>,
index_type: ChunkIndexType,
earray_params: Option<EarrayParams>,
farray_params: Option<FixedArrayParams>,
bt2_params: Option<Bt2Params>,
single_chunk_filter: Option<SingleChunkFilter>,
index_address: u64,
},
Virtual {
version: u8,
heap_address: u64,
heap_index: u32,
},
}Expand description
Data layout message payload.
Variants§
Contiguous
Contiguous storage — raw data in a single block.
Fields
Compact
Compact storage — raw data stored within the object header.
ChunkedV3
Version 3 chunked storage, indexed by a version-1 B-tree.
This is what libhdf5 / h5py writes for a chunked dataset created
with the default libver bounds.
Fields
ChunkedV4
Version 4 chunked storage. Version 5 shares this exact wire format — only the version byte differs — so both decode into this variant.
Fields
version: u8Message version byte: 4 or 5. Version 5 (libhdf5 2.0,
H5O_LAYOUT_VERSION_5) declares that the chunk index encodes
filtered-chunk sizes in a fixed sizeof_size-byte field instead
of the width derived from the chunk byte count, so a filter may
expand a chunk without overflowing the field. Readers older than
libhdf5 2.0 reject version 5.
index_type: ChunkIndexTypeType of chunk index structure.
earray_params: Option<EarrayParams>Extensible array parameters (present when index_type == ExtensibleArray).
farray_params: Option<FixedArrayParams>Fixed array parameters (present when index_type == FixedArray).
single_chunk_filter: Option<SingleChunkFilter>Filtered single-chunk parameters (present when index_type ==
SingleChunk and the layout’s filtered flag 0x02 is set).
Virtual
Virtual dataset storage (H5D_VIRTUAL): the layout carries no data
address of its own. heap_address/heap_index name the global
heap object holding the mapping list — decode it with
crate::format::messages::virtual_mapping::VirtualMappingList.
Implementations§
Source§impl DataLayoutMessage
impl DataLayoutMessage
Sourcepub fn check_against_dataset(
&self,
dataspace: &DataspaceMessage,
datatype: &DatatypeMessage,
ctx: &FormatContext,
) -> FormatResult<()>
pub fn check_against_dataset( &self, dataspace: &DataspaceMessage, datatype: &DatatypeMessage, ctx: &FormatContext, ) -> FormatResult<()>
The checks libhdf5 makes between a layout and the dataset’s sibling dataspace and datatype messages as the dataset opens, gathered in the one place the three decode side by side:
- A chunked layout’s stored dimensionality is the chunk rank plus one
trailing element-size dimension, so it must be exactly one more
than the dataspace rank (
H5O__layout_decode, H5Olayout.c; HDFGroup/hdf5#6508, CVE-2026-19025). Left to chunk I/O, disagreeing ranks decode the index keys at the wrong rank and the chunk grid cannot be indexed. - A compact layout’s stored bytes must be exactly the extent’s
element count times the stored element size (
H5D__compact_init, H5Dcompact.c:255-269). Left to I/O, a short payload is read past its end by any selection that reaches the missing elements.
Contiguous and virtual layouts have neither and always pass.
Sourcepub fn describe(&self) -> &'static str
pub fn describe(&self) -> &'static str
The storage class and message version, for a message that has to name which layout it is talking about.
Sourcepub fn contiguous_unallocated(size: u64) -> Self
pub fn contiguous_unallocated(size: u64) -> Self
Contiguous layout with no data allocated yet.
Sourcepub fn contiguous(address: u64, size: u64) -> Self
pub fn contiguous(address: u64, size: u64) -> Self
Contiguous layout pointing to allocated data.
Sourcepub fn chunked_v3_btree_v1(chunk_dims: Vec<u64>, b_tree_address: u64) -> Self
pub fn chunked_v3_btree_v1(chunk_dims: Vec<u64>, b_tree_address: u64) -> Self
Version 3 chunked layout indexed by a version-1 B-tree.
chunk_dims must include the trailing element-size dimension.
Sourcepub fn chunked_v4_earray(
version: u8,
chunk_dims: Vec<u64>,
earray_params: EarrayParams,
index_address: u64,
) -> Self
pub fn chunked_v4_earray( version: u8, chunk_dims: Vec<u64>, earray_params: EarrayParams, index_address: u64, ) -> Self
Version 4 chunked layout with extensible array index.
chunk_dims should include the trailing element-size dimension.
For example, for a 2D dataset with chunk=(1,4) and element_size=8,
pass chunk_dims = [1, 4, 8].
Sourcepub fn chunked_v4_farray(
version: u8,
chunk_dims: Vec<u64>,
farray_params: FixedArrayParams,
index_address: u64,
) -> Self
pub fn chunked_v4_farray( version: u8, chunk_dims: Vec<u64>, farray_params: FixedArrayParams, index_address: u64, ) -> Self
Version 4 chunked layout with fixed array index.
chunk_dims should include the trailing element-size dimension.
Sourcepub fn chunked_v4_btree_v2(
version: u8,
chunk_dims: Vec<u64>,
bt2_params: Bt2Params,
index_address: u64,
) -> Self
pub fn chunked_v4_btree_v2( version: u8, chunk_dims: Vec<u64>, bt2_params: Bt2Params, index_address: u64, ) -> Self
Version 4 chunked layout with B-tree v2 index.
chunk_dims should include the trailing element-size dimension.
Sourcepub fn chunked_v4_implicit(
version: u8,
chunk_dims: Vec<u64>,
index_address: u64,
) -> Self
pub fn chunked_v4_implicit( version: u8, chunk_dims: Vec<u64>, index_address: u64, ) -> Self
Version 4 chunked layout with the implicit index — no index structure
at all: index_address is the start of one contiguous run holding
every chunk of the maximum-extent grid in row-major order, so a
chunk’s address is arithmetic (H5D__none_idx_get_addr, H5Dnone.c).
chunk_dims should include the trailing element-size dimension.
Sourcepub fn virtual_layout(version: u8, heap_address: u64, heap_index: u32) -> Self
pub fn virtual_layout(version: u8, heap_address: u64, heap_index: u32) -> Self
Virtual dataset layout pointing at a global-heap mapping list.
Sourcepub fn chunked_v4_single(chunk_dims: Vec<u64>, index_address: u64) -> Self
pub fn chunked_v4_single(chunk_dims: Vec<u64>, index_address: u64) -> Self
Version 4 chunked layout with single-chunk index.
chunk_dims should include the trailing element-size dimension.
Sourcepub fn chunked_v4_single_filtered(
chunk_dims: Vec<u64>,
index_address: u64,
nbytes: u64,
filter_mask: u32,
) -> Self
pub fn chunked_v4_single_filtered( chunk_dims: Vec<u64>, index_address: u64, nbytes: u64, filter_mask: u32, ) -> Self
Version 4 chunked layout with a filtered single-chunk index: the
“single index with filter” flag (0x02) is set and the chunk’s
on-disk size and filter mask are carried inline
(H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER, H5Dsingle.c).
chunk_dims should include the trailing element-size dimension.