athena_rs 3.22.1

Hyper performant polyglot Database driver
Documentation
//! `/debug/schema` report-loading service helpers.
//!
//! This module owns diagnostics report-loading orchestration independent from
//! HTTP response formatting by delegating client resolution and per-client
//! report loading to focused helper modules while staged resolver-to-loader
//! handoff policy is delegated to
//! `debug_service_stage_output_assembly` and
//! `debug_service_from_stage_output_assembly`, which delegates to
//! `debug_service_stage_output_handoff_assembly`.

use crate::AppState;

use super::debug_contracts::LoggingSchemaDebugReport;
use super::debug_service_error::LoggingSchemaDebugReportError;
use super::debug_service_error_mapper::map_logging_client_resolution_error;
use super::debug_service_from_stage_output_assembly::build_debug_service_result_from_stage_output_assembly;
use super::debug_service_resolver::resolve_logging_client_pool;
use super::debug_service_stage_input_assembly::build_debug_service_stage_input_assembly;
use super::debug_service_stage_input_contracts::LoggingSchemaDebugReportServiceStageInput;
use super::debug_service_stage_output_assembly::build_debug_service_stage_output_assembly;

/// Loads the logging-client schema report used by `/debug/schema`.
pub(super) async fn load_logging_schema_debug_report(
    app_state: &AppState,
) -> Result<LoggingSchemaDebugReport, LoggingSchemaDebugReportError> {
    let stage_input: LoggingSchemaDebugReportServiceStageInput =
        build_debug_service_stage_input_assembly(
            resolve_logging_client_pool(app_state).map_err(map_logging_client_resolution_error)?,
        );
    let stage = build_debug_service_stage_output_assembly(stage_input);

    build_debug_service_result_from_stage_output_assembly(stage).await
}