Skip to main content

usage_report

Function usage_report 

Source
pub fn usage_report(
    rows: Vec<UsageRow>,
    since: &str,
    until: &str,
) -> UsageReport
Expand description

Fold the store’s flat (workspace, day) rows into the per-workspace report.

The store already did the aggregation; this only reshapes. Another adapter mapping in the ADR 0006 sense — UsageRow is a prospero-core type and UsageReport a prospero-types one, and neither crate should know about the other.

Rows are expected in (workspace, day) order — both SQL backends ORDER BY that way and the in-memory fold uses a BTreeMap — but this does not rely on it: groups are collected by name and each series sorted before returning, so a backend that ordered differently still produces the same report.