athena_rs 3.26.4

Hyper performant polyglot Database driver
Documentation
//! Report-loading helpers for `/debug/schema` services.
//!
//! This module owns snapshot-fetch orchestration for an already resolved
//! logging-client/pool pair while staged service-loader payload assembly is
//! delegated to `debug_service_loader_stage_input_assembly`,
//! `debug_service_loader_stage_output_assembly` and final
//! stage-output handoff is delegated to the stable facade in
//! `debug_service_loader_from_stage_output_assembly`, which delegates to
//! `debug_service_loader_stage_output_handoff_assembly`.

use super::debug_contracts::LoggingSchemaDebugReport;
use super::debug_service_loader_from_stage_output_assembly::build_debug_service_loader_result_from_stage_output_assembly;
use super::debug_service_loader_input_contracts::LoggingSchemaDebugReportForClientLoaderInput;
use super::debug_service_loader_stage_input_assembly::build_debug_service_loader_stage_input_assembly;
use super::debug_service_loader_stage_output_assembly::build_debug_service_loader_stage_output_assembly;
use super::debug_snapshot::fetch_logging_schema_snapshot;
use super::debug_snapshot_error::LoggingSchemaSnapshotError;

/// Loads a logging-schema debug report for one resolved logging client and pool.
pub(super) async fn load_logging_schema_debug_report_for_client(
    input: LoggingSchemaDebugReportForClientLoaderInput,
) -> Result<LoggingSchemaDebugReport, LoggingSchemaSnapshotError> {
    let LoggingSchemaDebugReportForClientLoaderInput {
        logging_client_name,
        pool,
    } = input;

    let stage_input = build_debug_service_loader_stage_input_assembly(
        logging_client_name,
        fetch_logging_schema_snapshot(&pool).await,
    );
    let stage = build_debug_service_loader_stage_output_assembly(stage_input);

    build_debug_service_loader_result_from_stage_output_assembly(stage)
}