znippy-common 0.9.11

Core logic and data structures for Znippy, a parallel chunked compression system.
extern crate core;

/// Re-export arrow so plugins implement `schema_fields()` against the exact same arrow
/// version as the core trait, avoiding type-mismatch across crate boundaries.
pub use arrow;

/// **Introspection / emit marker** — record one functional-status row for the
/// nornir test matrix. Wraps `nornir_testmatrix::functional_status` behind the
/// `testmatrix` feature (a compiled-out `#[inline]` no-op otherwise, with no
/// nornir dep in the default build). `component` is the reporting surface (e.g.
/// `"znippy-common/decompress"`), `check` what it verified, `ok` the REAL
/// verdict, `detail` a short measured note. The decompress path + the Magazine
/// slot-lifecycle self-tests call this so `nornir test --features testmatrix`
/// SEES each surface's health. Defined only under the feature — every call site
/// is itself `#[cfg(feature = "testmatrix")]` (so the detail-string work is
/// stripped in the default build, per the nornir-testmatrix doctrine), so there
/// is no non-feature caller to no-op for.
#[cfg(feature = "testmatrix")]
#[inline]
pub(crate) fn functional_status(component: &str, check: &str, ok: bool, detail: &str) {
    nornir_testmatrix::functional_status(component, check, ok, detail);
}

pub mod codec;
pub mod common_config;
pub mod index;
pub mod archive;
pub mod meta_sink;
pub mod meta_sink_append;

pub mod slotpool;

pub mod meta;
pub use meta::{BlobMeta, ChunkMeta, FileMeta};

/// Detached, streaming CMS provenance signatures (per-artifact + per-archive).
/// Off by default; default builds and the on-disk format are byte-unchanged.
#[cfg(feature = "sign")]
pub mod sign;

pub mod plugin;
pub mod plugins;
pub mod views;

pub mod decompress;

pub use archive::{ZnippyArchive, ZnippyReader};
pub use views::{
    CondaPackage, CondaView, GemPackage, GemView, MavenPackage, MavenView, NpmPackage, NpmView,
    PythonKind, PythonPackage, PythonView, RustPackage, RustView, CONDA_PKG_TYPE, GEM_PKG_TYPE,
    MAVEN_PKG_TYPE, NPM_PKG_TYPE, PYTHON_PKG_TYPE, RUST_PKG_TYPE,
};
pub use decompress::{decompress_archive, decompress_archive_filtered, get_file};
pub use meta_sink::{ArchiveMetaSink, ArrowIpcSink, GroupKey, MetaSinkFactory};
pub use meta_sink_append::{AppendReport, ArrowIpcSinkAppend, append_files};

pub use index::{
    ArchiveReader,
    ArtifactMeta, ChunkLoc, IndexFilter, VerifyReport, ZNIPPY_INDEX_SCHEMA,
    MULTI_INDEX_MAGIC, ManifestEntry, IndexFooter,
    build_arrow_metadata_for_config, build_metadata_batch,
    extract_config_from_arrow_metadata, get_all_files_meta, get_files_meta_with_prefix,
    interpret_footer,
    is_probably_compressed, is_reserved_module, list_archive_contents, locate_file,
    read_manifest_bytes, read_reserved_section_bytes, read_znippy_full_manifest, read_znippy_index,
    read_znippy_index_filtered, read_znippy_manifest,
    should_skip_compression, verify_archive_integrity, write_manifest_bytes,
    znippy_index_schema, SIGN_ARCHIVE_MODULE, SIGN_ARTIFACTS_MODULE,
};

#[derive(Debug)]
pub struct CompressionReport {
    pub total_files: u64,
    pub compressed_files: u64,
    pub uncompressed_files: u64,
    pub total_dirs: u64,
    pub total_bytes_in: u64,
    pub total_bytes_out: u64,
    pub compressed_bytes: u64,
    pub uncompressed_bytes: u64,
    pub compression_ratio: f32,
    pub chunks: u64,
}