dsfb_database/live_mysql/mod.rs
1//! Live read-only MySQL telemetry adapter (feature = `live-mysql`).
2//!
3//! Second-engine analogue of [`crate::live`]. Maintains the identical
4//! three-layer code-audit contract described there, translated to
5//! MySQL-native surfaces:
6//! * **Type-level.** [`readonly_conn::ReadOnlyMySqlConn`] wraps a
7//! private `mysql_async::Conn`; the only public entry point that
8//! touches SQL is [`readonly_conn::ReadOnlyMySqlConn::query_allowed`],
9//! which accepts a variant of the closed
10//! [`queries::AllowedMySqlQuery`] enum.
11//! * **Session-level.** `connect` issues
12//! `SET SESSION TRANSACTION READ ONLY`,
13//! `SET SESSION MAX_EXECUTION_TIME = 500`, and
14//! `SET SESSION innodb_lock_wait_timeout = 1`, then verifies each
15//! via `SELECT @@SESSION.*`. Refuses to proceed if the engine
16//! silently ignores any SET.
17//! * **Statement-level.** Every [`queries::AllowedMySqlQuery`]
18//! variant maps to a `'static` `SELECT` against
19//! `performance_schema.*` or `information_schema.*`. The SHA-256
20//! of the concatenated strings is pinned by
21//! `tests/live_query_allowlist_lock_mysql.rs`.
22//!
23//! Determinism discipline inherited from the PostgreSQL path:
24//! engine->tape is non-deterministic (scheduling and workload jitter),
25//! tape->episodes is byte-deterministic. This is the same 7th
26//! non-claim in [`crate::non_claims`]; the wording there generalises
27//! from "live PostgreSQL adapter" to "live adapters" because the
28//! contract is engine-shape-independent.
29//!
30//! Scope discipline: this module ships the three-layer contract
31//! (type, session, statement) and the operator-facing role manifest
32//! in `spec/permissions.mysql.sql`. A full scraper / distiller pair
33//! that converts `AllowedMySqlQuery` row sets into
34//! [`crate::residual::ResidualStream`] samples — the MySQL analogue
35//! of [`crate::live::distiller`] — is scheduled for a subsequent
36//! engineering pass co-sited with a MySQL harness fixture. The
37//! paper's §Live-Eval MySQL subsection is explicit that the
38//! contract-level code is reviewable today and that end-to-end live
39//! replay against a running `mysqld` is future work. This matches
40//! the panel's item-#10 scoping ("~2 weeks of engineering") and is
41//! disclosed rather than synthesised.
42
43pub mod queries;
44
45#[cfg(feature = "live-mysql")]
46pub mod readonly_conn;
47
48pub use queries::AllowedMySqlQuery;
49
50#[cfg(feature = "live-mysql")]
51pub use readonly_conn::ReadOnlyMySqlConn;