Skip to main content

zeppelin_embed/
lib.rs

1//! Embedded hybrid-search engine primitives.
2//!
3//! # Durability
4//!
5//! [`lifecycle::durability::DurabilityMode`] defaults to `Derived`. The default
6//! issues no synchronization primitive at any commit tier; under it,
7//! [`lifecycle::durability::CommitTier`] is ignored entirely. An application
8//! crash or process kill does not lose acknowledged writes because the
9//! operating-system page cache retains them and writes them out afterward. A
10//! power cut or kernel panic can lose recently acknowledged writes. Recovery
11//! truncates the log at the first record whose checksum fails, leaving a
12//! structurally valid store with a missing recent tail rather than silently
13//! wrong data.
14//!
15//! `Derived` asserts that another store is authoritative and this store can be
16//! rebuilt from it. If this store is the only copy of the data, select
17//! [`lifecycle::durability::DurabilityMode::Durable`] explicitly.
18
19#![deny(
20    clippy::expect_used,
21    clippy::indexing_slicing,
22    clippy::panic,
23    clippy::todo,
24    clippy::unimplemented,
25    clippy::unwrap_used,
26    unsafe_op_in_unsafe_fn
27)]
28#![warn(missing_docs)]
29
30#[cfg(feature = "allocation-audit")]
31mod allocation_audit;
32
33#[cfg(any(test, feature = "test-support"))]
34#[doc(hidden)]
35pub mod adversarial_test_support;
36
37/// Query diagnostics and health reporting.
38pub mod diag;
39/// Epoch identity and migration.
40pub mod epoch;
41/// Persisted-format framing, versions, and golden-fixture support.
42pub mod format;
43/// Full-text indexing and retrieval.
44pub mod fts;
45/// Hybrid result fusion.
46pub mod fusion;
47/// Per-segment vector graphs.
48pub mod graph;
49/// Ingest and mutation coordination.
50pub mod ingest;
51/// Runtime-dispatched compute kernels.
52pub mod kernels;
53/// Store lifecycle and memory accounting.
54pub mod lifecycle;
55/// Persistent manifest coordination.
56pub mod manifest;
57/// Columnar metadata and filters.
58pub mod meta;
59/// Query planning and selectivity decisions.
60pub mod planner;
61/// Training-free vector quantization.
62pub mod quant;
63/// Exact vector scanning.
64pub mod scan;
65/// Immutable segment representation.
66pub mod segment;
67/// Operating-system integration wrappers.
68pub mod sys;
69/// Adaptive storage tiers.
70pub mod tier;
71/// Virtual filesystem and platform I/O.
72pub mod vfs;
73/// Write-ahead logging and durability.
74pub mod wal;
75
76#[cfg(test)]
77mod test_support;
78
79/// The current crate version.
80pub const VERSION: &str = env!("CARGO_PKG_VERSION");
81
82#[cfg(test)]
83#[allow(
84    clippy::expect_used,
85    clippy::indexing_slicing,
86    clippy::panic,
87    clippy::unwrap_used
88)]
89mod tests {
90    use rand::RngCore;
91
92    #[test]
93    #[cfg_attr(miri, ignore = "environment-dependent RNG is outside the Miri subset")]
94    fn seeded_rng_is_deterministic_per_name_and_env() {
95        let mut first =
96            crate::test_support::seeded_rng("tests::seeded_rng_is_deterministic_per_name_and_env");
97        let mut second =
98            crate::test_support::seeded_rng("tests::seeded_rng_is_deterministic_per_name_and_env");
99        let mut other_name = crate::test_support::seeded_rng("tests::another_test");
100
101        let first_draw = first.next_u64();
102        let second_draw = second.next_u64();
103        let other_name_draw = other_name.next_u64();
104
105        let environment_seed = std::env::var("ZE_TEST_SEED").unwrap_or_else(|_| String::from("0"));
106        let other_environment_seed = format!("{environment_seed}-different");
107        let mut other_env = crate::test_support::seeded_rng_from(
108            "tests::seeded_rng_is_deterministic_per_name_and_env",
109            &other_environment_seed,
110        );
111        let other_env_draw = other_env.next_u64();
112
113        assert_eq!(first_draw, second_draw);
114        assert_ne!(first_draw, other_name_draw);
115        assert_ne!(first_draw, other_env_draw);
116    }
117
118    #[test]
119    fn version_constant_is_current() {
120        assert_eq!(crate::VERSION, "0.4.0");
121    }
122}