athena_rs 3.26.1

Hyper performant polyglot Database driver
Documentation
//! Expected-table evaluation contracts for `/debug/schema`.
//!
//! This module contains the shared status/counter data model used across
//! `/debug/schema` evaluation and summary composition. Expected-vs-observed
//! table comparison policy and accumulator mutation live in
//! `debug_evaluation_accumulator`.

use serde::Serialize;

/// Expected-table status in the logging-client diagnostics report.
#[derive(Debug, Clone, Serialize)]
pub struct LoggingSchemaExpectedTableStatus {
    /// Schema name.
    pub table_schema: String,
    /// Table name.
    pub table_name: String,
    /// `BASE TABLE` or `VIEW` expected by the runtime.
    pub expected_relation_type: String,
    /// Whether this table is required for healthy logging/runtime operation.
    pub required: bool,
    /// Why this table is expected.
    pub purpose: String,
    /// Runtime-required columns for this table.
    pub expected_columns: Vec<String>,
    /// Whether the table was discovered.
    pub found: bool,
    /// Relation type found in the database, when present.
    pub found_relation_type: Option<String>,
    /// Whether relation type matches expectation.
    pub relation_type_matches: bool,
    /// Discovered columns for this table when found.
    pub found_columns: Vec<String>,
    /// Required columns that are still missing.
    pub missing_columns: Vec<String>,
    /// Existing columns not listed in expected columns.
    pub unexpected_columns: Vec<String>,
}

/// Accumulator for expected-table evaluation counts and payload rows.
#[derive(Default)]
pub(super) struct ExpectedTablesEvaluation {
    /// Per-expected-table evaluation entries.
    pub(super) expected_tables: Vec<LoggingSchemaExpectedTableStatus>,
    /// Required missing table keys (`schema.table`).
    pub(super) missing_required_tables: Vec<String>,
    /// Optional missing table keys (`schema.table`).
    pub(super) missing_optional_tables: Vec<String>,
    /// Missing required column count.
    pub(super) required_missing_column_count: usize,
    /// Missing optional column count.
    pub(super) optional_missing_column_count: usize,
    /// Relation type mismatch count.
    pub(super) relation_type_mismatch_count: usize,
}