pub struct Header {Show 14 fields
pub magic: [u8; 4],
pub version: u32,
pub block_size: u32,
pub index_offset: u64,
pub parent_path: Option<String>,
pub dictionary_offset: Option<u64>,
pub dictionary_length: Option<u32>,
pub metadata_offset: Option<u64>,
pub metadata_length: Option<u32>,
pub signature_offset: Option<u64>,
pub signature_length: Option<u32>,
pub encryption: Option<KeyDerivationParams>,
pub compression: CompressionType,
pub features: FeatureFlags,
}Expand description
On-disk snapshot file header containing format metadata.
This structure is serialized at the beginning of every .hxz file and
describes the format version, compression settings, encryption parameters,
and locations of key data structures within the file.
§Binary Layout
The header occupies exactly 4096 bytes (HEADER_SIZE) at file offset 0 with the following logical structure:
- Magic bytes (4): File signature “HEXZ”
- Version (4): Format version number
- Block size (4): Logical block size in bytes
- Index offset (8): File offset to the master index structure
- Parent path (variable): Optional path for thin snapshots
- Dictionary offset/length: Optional compression dictionary location
- Metadata offset/length: Optional user metadata location
- Signature offset/length: Optional cryptographic signature location
- Encryption parameters: Optional key derivation settings
- Compression type: Algorithm used (LZ4 or Zstd)
- Feature flags: Capabilities enabled in this snapshot
§Versioning
The version field enables forward compatibility. Readers check this field
and reject files with incompatible versions. The current format version is
defined in the magic module.
§Thin Provisioning
When parent_path is set, this snapshot is a thin snapshot that references
blocks from the parent. Blocks marked with BLOCK_OFFSET_PARENT are
read from the parent snapshot instead of the current file.
Fields§
§magic: [u8; 4]§version: u32§block_size: u32§index_offset: u64§parent_path: Option<String>Path to the parent snapshot for thin provisioning. If None, this is a standalone (thick) snapshot.
dictionary_offset: Option<u64>§dictionary_length: Option<u32>§metadata_offset: Option<u64>§metadata_length: Option<u32>§signature_offset: Option<u64>§signature_length: Option<u32>§encryption: Option<KeyDerivationParams>§compression: CompressionType§features: FeatureFlagsImplementations§
Source§impl Header
impl Header
Sourcepub fn read_from<R: Read>(reader: &mut R) -> Result<Self>
pub fn read_from<R: Read>(reader: &mut R) -> Result<Self>
Read and deserialize a header from a std::io::Read source.
Sourcepub fn read_from_backend(backend: &dyn StorageBackend) -> Result<Self>
pub fn read_from_backend(backend: &dyn StorageBackend) -> Result<Self>
Read a header from a StorageBackend at offset 0.
Sourcepub fn load_dictionary(
&self,
backend: &dyn StorageBackend,
) -> Result<Option<Vec<u8>>>
pub fn load_dictionary( &self, backend: &dyn StorageBackend, ) -> Result<Option<Vec<u8>>>
Load the compression dictionary from the backend, if present.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Header
impl<'de> Deserialize<'de> for Header
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnsafeUnpin for Header
impl UnwindSafe for Header
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more