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;
19pub mod journal;
20pub mod manifest;
21pub mod pipeline;
22pub mod resource;
23pub mod source;
24pub mod state;
25pub mod tuning;
26pub mod types;
27
28// Public for the `rivet-mcp` binary in src/bin/. Not part of any external
29// API contract — same "internal, may change at any patch" disclaimer applies.
30pub mod mcp;
31
32// pub(crate) — internal implementation modules; not part of any external API contract
33pub(crate) mod destination;
34
35/// Test-only re-exports of the otherwise `pub(crate)` `destination` module.
36///
37/// Integration tests in `tests/` need to construct a `Box<dyn Destination>`
38/// to drive `pipeline::write_manifest` end-to-end, but the trait and factory
39/// stay `pub(crate)` to keep the destination surface internal.  This window
40/// re-exports just the two items required (`Destination`, `create_destination`)
41/// behind a clearly-marked module name so the public crate API doesn't grow.
42///
43/// Not part of any external API contract — same "internal, may change at any
44/// patch" disclaimer as the other lib modules in this file.
45#[doc(hidden)]
46pub mod destination_for_tests {
47    pub use crate::destination::{Destination, ObjectMeta, create_destination};
48}
49pub(crate) mod enrich;
50pub(crate) mod notify;
51pub(crate) mod plan;
52// Credential redaction invariant (ADR-0014, v0.7.2 P0.3).  `pub` so the
53// integration test `tests/redaction_invariant.rs` can drive it directly
54// — same "internal, may change at any patch" disclaimer as the rest of
55// the public-by-necessity surface.
56pub mod redact;
57// Test-only fault-injection hook used by `tests/live_crash_recovery.rs`.
58// Activated by the `RIVET_TEST_PANIC_AT` env var; no-op otherwise.  See
59// module docs for details.
60pub(crate) mod test_hook;
61// Preflight diagnostics. The `check` and `doctor` entry points are invoked
62// from `src/cli/dispatch.rs` (binary-only) and the internal
63// `get_export_diagnostic` is used by `pipeline::plan_cmd` (lib + binary).
64//
65// We expose this as `pub mod` rather than `pub(crate) mod` so dead-code
66// analysis sees the entry points as part of the crate's public API. Without
67// that, the lib compilation unit (which doesn't depend on `cli::dispatch`)
68// would mark the entire transitive surface as dead and force a blanket
69// `#[allow(dead_code)]` that silences genuine dead code inside the module.
70// Same "no external API contract" disclaimer as the other lib modules.
71pub mod preflight;
72pub(crate) mod quality;
73pub(crate) mod sql;