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// Re-exported so a downstream crate implementing `source::BatchSink` uses the
16// SAME arrow as this crate. Declaring arrow separately there would compile
17// against a second copy whose types are unrelated — the error is confusing and
18// the version skew is silent until it isn't.
19pub use arrow;
20
21// Public — accessed by integration tests in tests/*.rs
22pub mod config;
23pub mod error;
24pub mod format;
25// Fuzz-only entry points (feature = "fuzzing"); not part of the public API.
26#[cfg(feature = "fuzzing")]
27pub mod fuzz;
28pub mod journal;
29pub mod load;
30pub mod manifest;
31pub mod pipeline;
32pub mod resource;
33pub mod source;
34pub mod state;
35pub mod tuning;
36pub mod types;
37
38// Public for the `rivet-mcp` binary in src/bin/. Not part of any external
39// API contract — same "internal, may change at any patch" disclaimer applies.
40pub mod mcp;
41
42// pub(crate) — internal implementation modules; not part of any external API contract
43pub(crate) mod destination;
44
45/// Test-only re-exports of the otherwise `pub(crate)` `destination` module.
46///
47/// Integration tests in `tests/` need to construct a `Box<dyn Destination>`
48/// to drive `pipeline::write_manifest` end-to-end, but the trait and factory
49/// stay `pub(crate)` to keep the destination surface internal.  This window
50/// re-exports just the two items required (`Destination`, `create_destination`)
51/// behind a clearly-marked module name so the public crate API doesn't grow.
52///
53/// Not part of any external API contract — same "internal, may change at any
54/// patch" disclaimer as the other lib modules in this file.
55#[doc(hidden)]
56pub mod destination_for_tests {
57    pub use crate::destination::{Destination, ObjectMeta, create_destination};
58}
59// Public since §5h: the auditor recomputes `_rivet_row_hash` over re-extracted
60// sample rows, and it must do so with THIS function. A reimplementation on the
61// consumer side would be a second thing that can drift from the extractor —
62// which is exactly the failure §5h removes, and the reason there is only one
63// hash left to recompute.
64pub mod enrich;
65pub(crate) mod notify;
66pub(crate) mod plan;
67// Credential redaction invariant (ADR-0014, v0.7.2 P0.3).  `pub` so the
68// integration test `tests/redaction_invariant.rs` can drive it directly
69// — same "internal, may change at any patch" disclaimer as the rest of
70// the public-by-necessity surface.
71pub mod redact;
72// Test-only fault-injection hook used by `tests/live_crash_recovery.rs`.
73// Activated by the `RIVET_TEST_PANIC_AT` env var; no-op otherwise.  See
74// module docs for details.
75pub(crate) mod test_hook;
76// Preflight diagnostics. The `check` and `doctor` entry points are invoked
77// from `src/cli/dispatch.rs` (binary-only) and the internal
78// `get_export_diagnostic` is used by `pipeline::plan_cmd` (lib + binary).
79//
80// We expose this as `pub mod` rather than `pub(crate) mod` so dead-code
81// analysis sees the entry points as part of the crate's public API. Without
82// that, the lib compilation unit (which doesn't depend on `cli::dispatch`)
83// would mark the entire transitive surface as dead and force a blanket
84// `#[allow(dead_code)]` that silences genuine dead code inside the module.
85// Same "no external API contract" disclaimer as the other lib modules.
86pub mod preflight;
87pub(crate) mod quality;
88pub(crate) mod scalar;
89pub(crate) mod sql;