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
//! Expected logging-schema contract types used by `/debug/schema`.
//!
//! This module defines the data model for one expected logging-client relation
//! and helper methods reused across debug evaluation/report builders.
/// Internal specification for one expected logging-client relation.
#[derive(Debug, Clone, Copy)]
pub(super) struct ExpectedLoggingTable {
/// Schema name expected for the relation.
pub(super) table_schema: &'static str,
/// Relation name expected by runtime paths.
pub(super) table_name: &'static str,
/// Expected relation type (`BASE TABLE` / `VIEW`).
pub(super) relation_type: &'static str,
/// Whether the table is required for healthy runtime behavior.
pub(super) required: bool,
/// Short purpose description shown in diagnostics payloads.
pub(super) purpose: &'static str,
/// Columns expected by runtime writes/reads for this relation.
pub(super) required_columns: &'static [&'static str],
}
/// Helper methods for expected-table contract rows.
impl ExpectedLoggingTable {
/// Returns a stable `schema.table` key for this table spec.
pub(super) fn key(&self) -> String {
format!("{}.{}", self.table_schema.trim(), self.table_name.trim())
}
/// Returns expected columns as owned strings for API payload assembly.
pub(super) fn expected_columns(&self) -> Vec<String> {
self.required_columns
.iter()
.map(|column| (*column).to_string())
.collect()
}
}