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