build_catalog_metadata_from_connection

Function build_catalog_metadata_from_connection 

Source
pub(super) fn build_catalog_metadata_from_connection(
    connection: &Connection,
    current_hash: &str,
    previous_hash: &str,
) -> Result<CatalogMetadata>
Expand description

Builds validated catalog metadata from the live SQLite catalog database.

The function reads the total package count and the per-source breakdown from catalog_packages, then packages those counts together with the supplied current and previous hashes. The resulting metadata is validated before it is returned.

The query shape is intentionally simple and explicit: one total-count query and one grouped source-count query. That keeps the logic easy to audit and matches the schema contract used by the refresh pipeline.