Skip to main content

uqa_sql/catalog/events/
reads.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Borrow live event registries without copying their contents or releasing catalog guards.
8use super::{RuleCatalog, TriggerCatalog};
9use std::ops::Deref;
10pub type RuleCatalogRead<'a> = Box<dyn Deref<Target = RuleCatalog> + 'a>;
11pub type TriggerCatalogRead<'a> = Box<dyn Deref<Target = TriggerCatalog> + 'a>;
12pub trait EventCatalogReads {
13    fn read_rules(&self) -> RuleCatalogRead<'_>;
14    fn read_triggers(&self) -> TriggerCatalogRead<'_>;
15}
16
17/// Borrow statement-pinned event definitions and read the current replication role on demand.
18pub trait EventLookupState {
19    fn query_rules(&self) -> Option<&RuleCatalog>;
20    fn query_triggers(&self) -> Option<&TriggerCatalog>;
21    fn session_replication_role_is_replica(&self) -> bool;
22}