1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! 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,
}