#messagepack #container #lz4 #dhbin

dhara_dhbin

Generic MessagePack-based DHBIN v2 container for Dhara packages

2 releases

Uses new Rust 2024

new 0.4.4 May 14, 2026
0.4.0 Apr 24, 2026

#1811 in Encoding


Used in dhara_storage

Apache-2.0

38KB
615 lines

dhara_dhbin

crates.io

dhara_dhbin is the shared DHBIN v2 container crate used across the Dhara workspace.

It stores MessagePack payloads together with:

  • optional MessagePack metadata
  • optional integrity data
  • explicit package purposes that guide default read behavior
  • optional payload compression

Install

[dependencies]
dhara_dhbin = "0.4.4"

Quick Start

use dhara_dhbin::{
    CompressionKind, IntegrityKind, PackagePurpose, DhbinReader, DhbinWriteOptions, DhbinWriter,
};

let bytes = DhbinWriter::write_payload(
    &vec!["alpha".to_string(), "beta".to_string()],
    &DhbinWriteOptions {
        package_id: *b"CONF",
        purpose: PackagePurpose::Standard,
        compression: CompressionKind::Lz4Frame,
        flags: 0,
        metadata: None,
        integrity: IntegrityKind::Sha256,
    },
)?;

let decoded: Vec<String> = DhbinReader::decode_payload(&bytes)?;
# Ok::<(), Box<dyn std::error::Error>>(())

Read Profiles

  • PackagePurpose::Standard: verify integrity and load metadata by default
  • PackagePurpose::FastPayload: favor low-overhead payload access
  • PackagePurpose::Embedded: favor lightweight embedded runtime reads

Intended Use

dhara_dhbin is intentionally generic. It does not know about TrID definitions, Dhara metadata models, or any specific runtime payload schema. Those concerns live in higher-level crates such as dhara_storage and dhara_tool_dhara_storage.

Dependencies

~1.3–2.1MB
~47K SLoC