Skip to main content

rivet/
lib.rs

1//! **Rivet** — CLI tool to export PostgreSQL and MySQL tables to Parquet/CSV files
2//! (local, S3, GCS) with tuning profiles, preflight diagnostics, chunked parallelism,
3//! retry logic, and SQLite-backed state tracking.
4//!
5//! # Not a stable public API
6//!
7//! This crate (`rivet-cli` on crates.io) is a **CLI product**, not an embeddable library.
8//! The library target exists solely to support Rust's integration test harness (`tests/`
9//! requires a library to link against). Internal modules may change at any patch release
10//! without notice. See `docs/adr/0002-cli-product-vs-library.md` for the full decision.
11//!
12//! **Stable for integration tests**: `config`, `format`, `pipeline`, `resource`, `state`.
13//! All other modules are `pub(crate)` and not reachable from external consumers.
14
15// Public — accessed by integration tests in tests/*.rs
16pub mod config;
17pub mod error;
18pub mod format;
19// Fuzz-only entry points (feature = "fuzzing"); not part of the public API.
20#[cfg(feature = "fuzzing")]
21pub mod fuzz;
22pub mod journal;
23pub mod load;
24pub mod manifest;
25pub mod pipeline;
26pub mod resource;
27pub mod source;
28pub mod state;
29pub mod tuning;
30pub mod types;
31
32// Public for the `rivet-mcp` binary in src/bin/. Not part of any external
33// API contract — same "internal, may change at any patch" disclaimer applies.
34pub mod mcp;
35
36// pub(crate) — internal implementation modules; not part of any external API contract
37pub(crate) mod destination;
38
39/// Test-only re-exports of the otherwise `pub(crate)` `destination` module.
40///
41/// Integration tests in `tests/` need to construct a `Box<dyn Destination>`
42/// to drive `pipeline::write_manifest` end-to-end, but the trait and factory
43/// stay `pub(crate)` to keep the destination surface internal.  This window
44/// re-exports just the two items required (`Destination`, `create_destination`)
45/// behind a clearly-marked module name so the public crate API doesn't grow.
46///
47/// Not part of any external API contract — same "internal, may change at any
48/// patch" disclaimer as the other lib modules in this file.
49#[doc(hidden)]
50pub mod destination_for_tests {
51    pub use crate::destination::{Destination, ObjectMeta, create_destination};
52}
53pub(crate) mod enrich;
54pub(crate) mod notify;
55pub(crate) mod plan;
56// Credential redaction invariant (ADR-0014, v0.7.2 P0.3).  `pub` so the
57// integration test `tests/redaction_invariant.rs` can drive it directly
58// — same "internal, may change at any patch" disclaimer as the rest of
59// the public-by-necessity surface.
60pub mod redact;
61// Test-only fault-injection hook used by `tests/live_crash_recovery.rs`.
62// Activated by the `RIVET_TEST_PANIC_AT` env var; no-op otherwise.  See
63// module docs for details.
64pub(crate) mod test_hook;
65// Preflight diagnostics. The `check` and `doctor` entry points are invoked
66// from `src/cli/dispatch.rs` (binary-only) and the internal
67// `get_export_diagnostic` is used by `pipeline::plan_cmd` (lib + binary).
68//
69// We expose this as `pub mod` rather than `pub(crate) mod` so dead-code
70// analysis sees the entry points as part of the crate's public API. Without
71// that, the lib compilation unit (which doesn't depend on `cli::dispatch`)
72// would mark the entire transitive surface as dead and force a blanket
73// `#[allow(dead_code)]` that silences genuine dead code inside the module.
74// Same "no external API contract" disclaimer as the other lib modules.
75pub mod preflight;
76pub(crate) mod quality;
77pub(crate) mod scalar;
78pub(crate) mod sql;