/** * @file The align phase's accumulators as a record a worker writes and a coordinator merges. * * A serial build fills one set of accumulators by visiting every source's rows in adapter order. A parallel build * fills one set per align range. The coordinator merges those sets in adapter order, then range order, and visits the same rows * in the same order, so every sum is equal and every map lists its keys in the order the serial build first saw * them. The build manifest serializes those maps, and a key order that followed worker scheduling would change * its bytes. * * Maps are stored as entry arrays rather than objects, because an object lists integer-like keys first. */ import type { LicenseRefusalKind } from "@mailwoman/license/policy"; import type { AlignPhaseResult, AlignTally } from "#build/align"; import type { ComponentFindingCounts, ComponentRule } from "#build/component-check"; import type { SplitName } from "#utils/split"; /** * The align accumulators of one source, one align range, or one whole build. */ export interface AlignTotals extends AlignTally { counts: Record; licenseCounts: Map; refusedByKind: Map; refusedBySource: Map; trainRowsLeftOutBySource: Map; rowsBySource: Map; ineligibleSources: Map; /** * Every license value the policy refused, with its refusal kind. */ refusedValues: Map; componentFindingsBySource: ComponentFindingCounts; uncheckedComponentRules: Set; regionValues: Map; } /** * {@linkcode AlignTotals} as JSON. */ export interface AlignTotalsRecord { aligned: number; quarantined: number; excluded_by_license: number; admitted_unresolved_license_rows: number; excluded_by_eligibility: number; counts: Record; license_counts: [string, number][]; refused_by_kind: [LicenseRefusalKind, number][]; refused_by_source: [string, number][]; /** * Absent from a record written before `trainShare` existed. */ train_rows_left_out_by_source?: [string, number][]; rows_by_source: [string, { rows: number; license: string; }][]; ineligible_sources: [string, readonly string[]][]; refused_license_values: [string, LicenseRefusalKind][]; component_findings_by_source: [string, [ComponentRule, number][]][]; unchecked_component_rules: ComponentRule[]; /** * The rows that reached the component check with a region, per `regionValueKey`. * * Absent from a record written before the region data left the source derivation. */ region_values?: [string, number][]; } /** * The totals of a finished align phase. */ export declare function alignTotalsOf(result: AlignPhaseResult): AlignTotals; export declare function serializeAlignTotals(totals: AlignTotals): AlignTotalsRecord; /** * Merge records in the order their rows would have been aligned by one serial pass. * * Sums add. * `rowsBySource` keeps the license of the last record that saw the source, because the * serial align phase records each contributing row's license over the one before. * * The ineligibility reasons and refused values keep their first sighting, as the serial phase's caches do. */ export declare function mergeAlignTotals(records: readonly AlignTotalsRecord[]): AlignTotals; //# sourceMappingURL=totals.d.ts.map