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 codec;
51pub mod container;
52pub mod dra;
53pub mod encode;
54pub mod entropy;
55pub mod error;
56pub mod integrity;
57pub mod limits;
58pub mod materialize;
59
60pub use error::{Error, ErrorClass, Result};
61pub use limits::Limits;
62
63/// The exactness profile mandated for the archival path.
64///
65/// Only `EXACT_BYTES` is normative. Canonical and semantic profiles are
66/// deliberately absent until they can be named and measured separately.
67pub const EXACTNESS_PROFILE_EXACT_BYTES: u8 = 0;
68
69/// Identifier for the opaque source-format class.
70pub const SOURCE_FORMAT_OPAQUE: u8 = 0;
71
72/// Identifier for the PDF source-format class.
73///
74/// A descriptor declaring this class is still bound by the exact profile: its
75/// program must reconstruct the original PDF bytes exactly. The class records
76/// only how the source was analyzed, never a license to alter it.
77pub const SOURCE_FORMAT_PDF: u8 = 1;