Skip to main content

dsfb_database/
lib.rs

1#![forbid(unsafe_code)]
2
3//! # dsfb-database
4//!
5//! Deterministic, read-only structural observer over residual trajectories in
6//! SQL database telemetry. Built on the [`dsfb`] core (Drift–Slew Fusion
7//! Bootstrap) by R. de Beer (2026); this crate adds only the
8//! database-specific residual *construction* and motif *grammar*.
9//!
10//! ## What this crate is
11//!
12//! `dsfb-database` consumes residual streams that production SQL engines
13//! already emit (`pg_stat_statements`, `pg_stat_io`, `pg_stat_activity`;
14//! `sys.dm_exec_query_stats`, `sys.query_store_*`; MySQL Performance Schema;
15//! Oracle ASH/AWR/`V$SQL_PLAN_STATISTICS_ALL`) and structures them into a
16//! small grammar of operator-legible *motif episodes*:
17//!
18//!   1. plan-regression onset
19//!   2. cardinality-mismatch regime
20//!   3. contention ramp
21//!   4. cache / buffer collapse
22//!   5. workload phase transition
23//!
24//! ## What this crate is NOT
25//!
26//! It does **not** optimise queries, replace the optimiser, modify execution
27//! plans, change DBMS behaviour, or claim causal correctness. See
28//! [`non_claims`] (re-exported below) — these strings are pinned by a
29//! compile-time test (`tests/non_claim_lock.rs`).
30
31pub mod adapters;
32pub mod baselines;
33pub mod grammar;
34#[cfg(feature = "live-postgres")]
35pub mod live;
36pub mod live_mysql;
37pub mod metrics;
38pub mod metrics_exporter;
39pub mod non_claims;
40pub mod perturbation;
41pub mod report;
42pub mod residual;
43pub mod streaming;
44
45pub use grammar::{Episode, MotifClass, MotifEngine, MotifGrammar};
46pub use residual::{ResidualClass, ResidualSample, ResidualStream};
47
48/// The crate version as recorded in `Cargo.toml`. Embedded in every report so
49/// that figures can be traced back to the exact code that produced them.
50pub const CRATE_VERSION: &str = env!("CARGO_PKG_VERSION");