euv-core 0.57.0

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// 8-byte binary magic signature identifying `.euvpak` virtual filesystem archives.
pub const EUVPAK_MAGIC: [u8; 8] = *b"EUVPAK01";

/// Current `.euvpak` container format version.
pub const EUVPAK_FORMAT_VERSION: u32 = 1;

/// Mandatory 64-byte payload alignment for `.euvpak` entries.
pub const EUVPAK_ALIGNMENT_BYTES: usize = 64;

/// Fixed 64-byte cache-line-aligned container header length.
pub(crate) const EUVPAK_HEADER_BYTES: usize = 64;

/// Fixed 48-byte open-addressed hash table TOC bucket length.
pub(crate) const EUVPAK_TOC_BUCKET_BYTES: usize = 48;

/// Minimum power-of-two bucket count for the open-addressed TOC hash table.
pub(crate) const EUVPAK_MIN_TOC_BUCKETS: usize = 16;

/// Header flag bit indicating CRC32 integrity verification metadata is populated.
pub(crate) const EUVPAK_FLAG_CRC32_ENABLED: u32 = 1;

/// Compression tag indicating raw uncompressed payload bytes.
pub(crate) const EUVPAK_COMPRESSION_NONE: u8 = 0;

/// Compression tag indicating pure-Rust LZ4 block compression.
pub(crate) const EUVPAK_COMPRESSION_LZ4: u8 = 1;

/// Open-addressed TOC bucket sentinel marking an unoccupied slot.
pub(crate) const EUVPAK_BUCKET_EMPTY: u8 = 0;

/// Open-addressed TOC bucket sentinel marking an occupied slot.
pub(crate) const EUVPAK_BUCKET_OCCUPIED: u8 = 1;

/// FNV-1a 64-bit hash offset basis used for normalized virtual paths.
pub(crate) const EUVPAK_FNV1A_OFFSET: u64 = 0xcbf2_9ce4_8422_2325;

/// FNV-1a 64-bit hash prime multiplier used for normalized virtual paths.
pub(crate) const EUVPAK_FNV1A_PRIME: u64 = 0x0000_0100_0000_01b3;

/// Log2 size of the stack-allocated LZ4 4-byte match hash table (`4096` slots).
pub(crate) const LZ4_HASH_LOG: usize = 12;

/// Entry count of the stack-allocated LZ4 4-byte match hash table.
pub(crate) const LZ4_HASH_SIZE: usize = 1 << LZ4_HASH_LOG;

/// Minimum LZ4 back-reference match length in bytes.
pub(crate) const LZ4_MIN_MATCH: usize = 4;

/// Mandatory trailing uncompressed literal run reserved by the LZ4 block format.
pub(crate) const LZ4_LAST_LITERALS: usize = 5;

/// Minimum input length required before searching for LZ4 matches.
pub(crate) const LZ4_MF_LIMIT: usize = 12;

/// Maximum LZ4 backward match offset in bytes (`65535`).
pub(crate) const LZ4_MAX_DISTANCE: usize = 65_535;

/// Knuth multiplicative hash constant used for 4-byte LZ4 sequence hashing.
pub(crate) const LZ4_HASH_MULTIPLIER: u32 = 2_654_435_761;

/// IEEE 802.3 CRC32 reversed polynomial.
pub(crate) const EUVPAK_CRC32_POLY: u32 = 0xEDB8_8320;

/// Compile-time 4x256 slice-by-4 IEEE 802.3 CRC32 lookup tables for high-throughput integrity checks.
pub(crate) const EUVPAK_CRC32_TABLES: [[u32; 256]; 4] = build_euvpak_crc32_tables();

/// Error returned when an `.euvpak` buffer is too short, misaligned, or fails structural validation.
pub(crate) const ERR_EUVPAK_INVALID_ARCHIVE: &str = "euvpak: invalid or truncated archive";

/// Error returned when an `.euvpak` header, TOC, or entry fails CRC32 integrity verification.
pub(crate) const ERR_EUVPAK_CRC_MISMATCH: &str = "euvpak: integrity CRC32 checksum mismatch";

/// Error returned when an entry hash or virtual path does not exist inside the archive.
pub(crate) const ERR_EUVPAK_ENTRY_NOT_FOUND: &str = "euvpak: requested entry not found";

/// Error returned when an LZ4 compressed payload violates block framing or offset bounds.
pub(crate) const ERR_EUVPAK_LZ4_CORRUPT: &str = "euvpak: corrupted LZ4 compressed block";

/// Error returned when an LZ4 decoded output length does not match expected uncompressed size.
pub(crate) const ERR_EUVPAK_LZ4_SIZE_MISMATCH: &str = "euvpak: LZ4 decoded length mismatch";