Skip to main content

uqa_engine/capabilities/
index_routines.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Bind routine-dependent index reads to the live registry and its catalog provider.
8
9use crate::Engine;
10use uqa_execution::schema::indexes::routines::{
11    self, IndexRoutineContext, IndexRoutineRead, IndexRoutineRegistry,
12};
13use uqa_sql::ast::FunctionBinding;
14use uqa_storage::{CatalogIndexRow, StorageBackendResult};
15
16impl Engine {
17    pub(crate) fn rewrite_index_routine_identity(
18        &self,
19        target: &FunctionBinding,
20        name: &str,
21    ) -> StorageBackendResult<()> {
22        routines::rewrite_index_routine_identity(
23            &IndexRoutineContext {
24                registry: self,
25                catalog: self.storage.catalog.as_deref(),
26            },
27            target,
28            name,
29        )
30    }
31}
32impl IndexRoutineRegistry for Engine {
33    fn routine_index_rows(&self) -> IndexRoutineRead<'_> {
34        Box::new(self.durable.catalog_indexes.read())
35    }
36    fn publish_routine_index_row(&self, row: CatalogIndexRow) {
37        self.durable
38            .catalog_indexes
39            .write()
40            .insert(row.relation.clone(), row);
41    }
42}