Skip to main content

vole_document/
lib.rs

1//! # VOLE-Document
2//!
3//! Byte-exact procedural document storage.
4//!
5//! The governing invariant of the exact profile is:
6//!
7//! ```text
8//! materialize(descriptor) == original_bytes
9//! ```
10//!
11//! Parsing, semantic equivalence, canonicalization, or a successful round trip
12//! through a document writer are **not** substitutes for this invariant.
13//!
14//! ## Layered representation
15//!
16//! A persisted `.voldoc` descriptor is a bounded, deterministic reconstruction
17//! description:
18//!
19//! ```text
20//! source bytes X
21//!     -> deterministic format analysis (advisory; never destructive)
22//!     -> bounded reconstruction hypothesis
23//!     -> Document Reconstruction Algebra program + parameters + typed residuals
24//!     -> (later) typed entropy channels / rANS entropy-seed capsules
25//!     -> canonical .voldoc descriptor
26//!     -> bounded deterministic materializer
27//!     -> X exactly
28//! ```
29//!
30//! rANS, when it eventually arrives, is the *entropy substrate beneath* the
31//! representation. It is not the procedural model, and an integer state is not
32//! a magic seed: a complete decoder-entry capsule carries model, state,
33//! renormalization payload, counts, and integrity.
34//!
35//! ## Phase status
36//!
37//! This crate currently implements the **exact container core** (paper Phase A
38//! / brief Phase 1): framing, typed errors, resource limits, integrity, the
39//! literal Document Reconstruction Algebra, the coverage certificate, RAW exact
40//! representation, the CLI, and decode-before-commit. No compression claim is
41//! made yet.
42//!
43//! See `PROJECT_STATE.md` for the mechanism ledger and `SPEC.md` for the
44//! provisional wire format.
45
46#![forbid(unsafe_code)]
47
48pub mod accounting;
49pub mod adapter;
50pub mod container;
51pub mod dra;
52pub mod encode;
53pub mod entropy;
54pub mod error;
55pub mod integrity;
56pub mod limits;
57pub mod materialize;
58
59pub use error::{Error, ErrorClass, Result};
60pub use limits::Limits;
61
62/// The exactness profile mandated for the archival path.
63///
64/// Only `EXACT_BYTES` is normative. Canonical and semantic profiles are
65/// deliberately absent until they can be named and measured separately.
66pub const EXACTNESS_PROFILE_EXACT_BYTES: u8 = 0;
67
68/// Identifier for the opaque source-format class.
69pub const SOURCE_FORMAT_OPAQUE: u8 = 0;
70
71/// Identifier for the PDF source-format class.
72///
73/// A descriptor declaring this class is still bound by the exact profile: its
74/// program must reconstruct the original PDF bytes exactly. The class records
75/// only how the source was analyzed, never a license to alter it.
76pub const SOURCE_FORMAT_PDF: u8 = 1;