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/// Generations are opaque equality tokens, not clocks or counts. A logical
16/// provider may use a separate domain for transaction-private changes; rollback
17/// restores the prior tokens and commit replaces them with durable generations.
18#[derive(Clone, Debug, Default, PartialEq, Eq)]
19pub struct CatalogCacheRevisions {
20 pub table_catalog: u64,
21 pub registries: u64,
22 /// Per-graph generations, separate from SQL registries. `None` preserves
23 /// conservative restoration for providers without graph-scoped tracking.
24 pub graphs: Option<BTreeMap<String, u64>>,
25 pub table_data: BTreeMap<String, u64>,
26 pub column_statistics: BTreeMap<String, u64>,
27 pub statistics_maintenance: BTreeMap<String, u64>,
28 /// Physical schema changes also invalidate bindings, even when a caller
29 /// changed the storage schema without an ordinary catalog operation.
30 pub storage_schema: u64,
31}