faucet_cli/partition/mod.rs
1//! Generic range partitioning (#479) — split one matrix row into N independent
2//! invocations, each scoped to a chunk of a range via `${partition.*}` tokens.
3//!
4//! This is source-agnostic by construction: substitution walks the string leaves
5//! of a connector config, so a REST URL, a SQL `WHERE`, an object prefix and a
6//! Mongo filter all work with no connector code. See the [`mod@plan`] module for
7//! the mechanism and [`spec`] for why the kinds are a tagged enum.
8
9pub mod plan;
10pub mod probe;
11pub mod spec;
12
13pub use plan::{PartitionChunk, plan, references_partition, substitute};
14pub use probe::{needs_probe, resolve_bounds};
15
16/// Resolve every discoverable partition bound in `cfg` in place (#479).
17///
18/// Runs before `expand`, because planning needs concrete bounds and `expand` is
19/// synchronous with no registry access. A config with no probes does no I/O.
20pub async fn resolve_config_bounds(
21 cfg: &mut crate::config::PipelineConfig,
22 auth: &crate::auth_catalog::AuthCatalog,
23) -> crate::error::CliResult<()> {
24 if let Some(spec) = cfg.partition.clone() {
25 cfg.partition = Some(resolve_bounds(&spec, auth).await?);
26 }
27 for row in &mut cfg.matrix {
28 if let Some(spec) = row.partition.clone() {
29 row.partition = Some(resolve_bounds(&spec, auth).await?);
30 }
31 }
32 Ok(())
33}
34pub use spec::{BoundProbe, CountBound, IntBound, PartitionSpec};