Skip to main content

Module ingest

Module ingest 

Expand description

Stream commits from a Repo into DuckDB via the N gix workers → bounded crossbeam channel → 1 Appender thread pattern. See spec §3.2.2.

Threading model: duckdb::Connection contains RefCell, which is !Sync. Therefore &FactsDb is !Send and the Appender must run on the thread that owns the FactsDb. We flip the design: the producer runs in a scoped spawned thread (Repo is Send + Sync) and the consumer (Appender) runs on the calling thread.

Re-exports§

pub use at_rev::ingest_complexity_at_rev;
pub use at_rev::materialize_imports_at_rev;

Modules§

at_rev
Rev-parameterized ingest helpers. Materializes complexity metrics and import-graph edges for an arbitrary revision into caller-named temporary tables, enabling the health timeline to build a HealthScanCtx that points at historical data instead of the HEAD tables.

Structs§

IngestStats

Functions§

apply_grouping
Apply architectural grouping in-place on the changes table. Called by FactsDb::ingest after raw ingest if opts.group_file.is_some().
materialize_changes_bucketed
Materialize a session-temporary changes_bucketed table that collapses commits within the same date_trunc(<bucket>, commit.date) window into a single logical “commit” per (bucket, path). Coupling-family analyses (coupling, clone-coupling indirectly, soc) query this table when opts.time_bucket.is_some() so commits landed across the same day/week/month count as one for pair-counting purposes.
materialize_changes_lineage
Materialize changes_lineagechanges with path canonicalized via the rename-lineage map. Calls materialize_path_lineage first so the lookup table is in scope.
materialize_path_lineage
Materialize the rename-lineage map as a temporary table.
set_channel_capacity_override
Bench hook: set the channel-capacity override for subsequent ingest() calls. Pass 0 to restore the default. Exists so V6’s ingest_capacity_sweep bench can vary the bound across [16, 64, 256, 1024] in one cargo bench invocation — unsafe { env::set_var } would violate the workspace unsafe_code = "forbid" lint and a cfg(test) gate wouldn’t fire in cargo bench.