Skip to main content

uqa_storage/catalog/
cache_revisions.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Transaction-visible invalidation generations, without loading catalog payloads.
8
9use std::collections::BTreeMap;
10
11/// Lightweight generations read from the same storage snapshot as catalog and
12/// row data. Providers must advance them atomically with the corresponding
13/// mutation, including direct storage writes, and restore them on rollback.
14/// Missing support is distinct from an empty, unchanged database.
15#[derive(Clone, Debug, Default, PartialEq, Eq)]
16pub struct CatalogCacheRevisions {
17    pub table_catalog: u64,
18    pub registries: u64,
19    /// Per-graph generations, separate from SQL registries. `None` preserves
20    /// conservative restoration for providers without graph-scoped tracking.
21    pub graphs: Option<BTreeMap<String, u64>>,
22    pub table_data: BTreeMap<String, u64>,
23    pub column_statistics: BTreeMap<String, u64>,
24    pub statistics_maintenance: BTreeMap<String, u64>,
25    /// Physical schema changes also invalidate bindings, even when a caller
26    /// changed the storage schema without an ordinary catalog operation.
27    pub storage_schema: u64,
28}