athena_rs 3.26.2

Hyper performant polyglot Database driver
Documentation
//! Final `/debug/schema` report payload assembly policy.
//!
//! This module owns constructing `LoggingSchemaDebugReport` from already
//! evaluated and normalized diagnostics parts while report metadata and legacy
//! compatibility fields are delegated to `debug_report_output_metadata_assembly`
//! and observed-table ordering is delegated to
//! `debug_report_output_observed_sort_stage`. Staged output payload assembly is
//! entered via typed payload contracts from `debug_report_output_input_contracts`
//! so callers can hand off one field-named payload instead of positional
//! arguments. Staged output payload assembly is
//! entered via `debug_report_output_assembly_stage_input_assembly`,
//! delegated to `debug_report_output_assembly_stage_output_assembly` and final
//! stage handoff is delegated to the stable facade in
//! `debug_report_output_assembly_from_stage_output_assembly`, which delegates to
//! `debug_report_output_assembly_stage_output_handoff_assembly`, which
//! delegates contract projection to
//! `debug_report_output_assembly_stage_output_contract_handoff_assembly`.

use super::debug_contracts::LoggingSchemaDebugReport;
use super::debug_report_output_assembly_from_stage_output_assembly::build_logging_schema_debug_report_from_output_assembly_from_stage_output_assembly;
use super::debug_report_output_assembly_stage_input_assembly::build_debug_report_output_assembly_stage_input_assembly;
use super::debug_report_output_assembly_stage_input_contracts::LoggingSchemaDebugReportOutputAssemblyStageInput;
use super::debug_report_output_assembly_stage_output_assembly::build_debug_report_output_assembly_stage_output_assembly;
use super::debug_report_output_input_contracts::LoggingSchemaDebugReportOutputInput;
use super::debug_report_output_metadata_assembly::build_logging_schema_debug_report_output_metadata;
use super::debug_report_output_observed_sort_stage::build_debug_report_output_sorted_observed_tables;

/// Builds the final `/debug/schema` report payload from one typed input payload.
pub(super) fn build_logging_schema_debug_report_from_input(
    input: LoggingSchemaDebugReportOutputInput,
) -> LoggingSchemaDebugReport {
    let LoggingSchemaDebugReportOutputInput {
        logging_client,
        summary,
        evaluation,
        still_needed,
        observed_map,
    } = input;

    let observed_tables = build_debug_report_output_sorted_observed_tables(observed_map);
    let output_metadata =
        build_logging_schema_debug_report_output_metadata(&still_needed, observed_tables);
    let stage_input: LoggingSchemaDebugReportOutputAssemblyStageInput =
        build_debug_report_output_assembly_stage_input_assembly(
            logging_client,
            summary,
            evaluation,
            still_needed,
            output_metadata,
        );
    let stage = build_debug_report_output_assembly_stage_output_assembly(stage_input);

    build_logging_schema_debug_report_from_output_assembly_from_stage_output_assembly(stage)
}