pub struct TableCatalog { /* private fields */ }Expand description
A collection of tables managed by the storage engine.
Uses DashMap internally for lock-free concurrent reads.
Write operations synchronize on individual entries rather than
the entire catalog, allowing concurrent writers to different
tables to proceed in parallel.
Implementations§
Source§impl TableCatalog
impl TableCatalog
pub fn new() -> Self
pub fn create_node_table( &self, name: String, columns: Vec<ColumnDefinition>, ) -> NodeTable
Sourcepub fn create_node_table_with_id(
&self,
table_id: u64,
name: String,
columns: Vec<ColumnDefinition>,
) -> NodeTable
pub fn create_node_table_with_id( &self, table_id: u64, name: String, columns: Vec<ColumnDefinition>, ) -> NodeTable
Recreate a node table at a specific table ID (used when restoring a
persisted catalog during recovery). Advances next_table_id so that
subsequent auto-assigned IDs never collide with restored ones.
pub fn create_rel_table( &self, name: String, src_table_id: u64, dst_table_id: u64, columns: Vec<ColumnDefinition>, ) -> RelTable
Sourcepub fn create_rel_table_with_id(
&self,
table_id: u64,
name: String,
src_table_id: u64,
dst_table_id: u64,
columns: Vec<ColumnDefinition>,
) -> RelTable
pub fn create_rel_table_with_id( &self, table_id: u64, name: String, src_table_id: u64, dst_table_id: u64, columns: Vec<ColumnDefinition>, ) -> RelTable
Recreate a rel table at a specific table ID (used when restoring a
persisted catalog during recovery). Advances next_table_id so that
subsequent auto-assigned IDs never collide with restored ones.
pub fn get_node_table(&self, table_id: u64) -> Option<Ref<'_, u64, NodeTable>>
pub fn get_node_table_mut( &self, table_id: u64, ) -> Option<RefMut<'_, u64, NodeTable>>
pub fn get_node_table_by_name( &self, name: &str, ) -> Option<Ref<'_, u64, NodeTable>>
pub fn get_node_table_by_name_mut( &self, name: &str, ) -> Option<RefMut<'_, u64, NodeTable>>
pub fn get_rel_table(&self, table_id: u64) -> Option<Ref<'_, u64, RelTable>>
pub fn get_rel_table_mut( &self, table_id: u64, ) -> Option<RefMut<'_, u64, RelTable>>
pub fn get_rel_table_by_name( &self, name: &str, ) -> Option<Ref<'_, u64, RelTable>>
pub fn get_rel_table_by_name_mut( &self, name: &str, ) -> Option<RefMut<'_, u64, RelTable>>
Sourcepub fn has_incident_edges(&self, table_id: u64, node_idx: u64) -> bool
pub fn has_incident_edges(&self, table_id: u64, node_idx: u64) -> bool
Check if a node has any incident edges.
Sourcepub fn detach_node(&self, table_id: u64, node_idx: u64)
pub fn detach_node(&self, table_id: u64, node_idx: u64)
Delete all incident edges for a given node.
pub fn all_node_tables(&self) -> Vec<RefMulti<'_, u64, NodeTable>>
pub fn all_rel_tables(&self) -> Vec<RefMulti<'_, u64, RelTable>>
Sourcepub fn node_table_num_rows(&self, name: &str) -> u64
pub fn node_table_num_rows(&self, name: &str) -> u64
Get the number of rows in a node table by name.
Sourcepub fn drop_node_table(&self, name: &str) -> bool
pub fn drop_node_table(&self, name: &str) -> bool
Remove a node table by name. Returns true if the table existed.
Sourcepub fn create_vector_index(
&self,
name: String,
table_name: String,
column_name: String,
metric: DistanceMetric,
dimensions: u32,
) -> VectorIndexTable
pub fn create_vector_index( &self, name: String, table_name: String, column_name: String, metric: DistanceMetric, dimensions: u32, ) -> VectorIndexTable
Create a new vector index in the catalog.
Sourcepub fn get_vector_index(
&self,
index_id: u64,
) -> Option<Ref<'_, u64, VectorIndexTable>>
pub fn get_vector_index( &self, index_id: u64, ) -> Option<Ref<'_, u64, VectorIndexTable>>
Get a vector index by its ID.
Sourcepub fn get_vector_index_by_name(
&self,
name: &str,
) -> Option<Ref<'_, u64, VectorIndexTable>>
pub fn get_vector_index_by_name( &self, name: &str, ) -> Option<Ref<'_, u64, VectorIndexTable>>
Get a vector index by name.
Sourcepub fn get_vector_index_by_name_mut(
&self,
name: &str,
) -> Option<RefMut<'_, u64, VectorIndexTable>>
pub fn get_vector_index_by_name_mut( &self, name: &str, ) -> Option<RefMut<'_, u64, VectorIndexTable>>
Get a mutable vector index by name.
Sourcepub fn get_vector_index_mut(
&self,
index_id: u64,
) -> Option<RefMut<'_, u64, VectorIndexTable>>
pub fn get_vector_index_mut( &self, index_id: u64, ) -> Option<RefMut<'_, u64, VectorIndexTable>>
Get a mutable vector index by ID.
Sourcepub fn drop_vector_index(&self, name: &str) -> bool
pub fn drop_vector_index(&self, name: &str) -> bool
Remove a vector index by name. Returns true if the index existed.
Sourcepub fn all_vector_indexes(&self) -> Vec<RefMulti<'_, u64, VectorIndexTable>>
pub fn all_vector_indexes(&self) -> Vec<RefMulti<'_, u64, VectorIndexTable>>
Get all vector indexes.
Sourcepub fn refresh_vector_index(&self, index_id: u64)
pub fn refresh_vector_index(&self, index_id: u64)
Rebuild a vector index from the current contents of its node table.
The HNSW graph is re-populated with the live row ids and vectors, so
INSERT/DELETE after CREATE VECTOR INDEX are always reflected (P52.38).
Sourcepub fn refresh_vector_indexes_for_tables(&self, table_ids: &[u64])
pub fn refresh_vector_indexes_for_tables(&self, table_ids: &[u64])
Rebuild the vector indexes of all node tables written by a statement.
Called after successful writes so the on-disk/in-memory HNSW graph never serves stale or wrongly-positioned rows (P52.38).
Sourcepub fn create_art_index(
&self,
table_name: &str,
index_name: &str,
) -> Result<(), StorageError>
pub fn create_art_index( &self, table_name: &str, index_name: &str, ) -> Result<(), StorageError>
Create an ART (Adaptive Radix Tree) index on a node table’s PK column.
Creates a new ArtPrimaryKeyIndex, backfills it with all existing rows,
and attaches it to the NodeTable.
The index_name is used as the BufferManager file name for persistence.
Sourcepub fn drop_art_index(&self, table_name: &str) -> Result<(), StorageError>
pub fn drop_art_index(&self, table_name: &str) -> Result<(), StorageError>
Drop the ART index from a node table.
Sourcepub fn get_art_index(&self, table_name: &str) -> Option<ArtPrimaryKeyIndex>
pub fn get_art_index(&self, table_name: &str) -> Option<ArtPrimaryKeyIndex>
Get a reference to the ART index for a node table (via table name).
Returns None if the table has no ART index or doesn’t exist.
Sourcepub fn has_art_index(&self, table_name: &str) -> bool
pub fn has_art_index(&self, table_name: &str) -> bool
Check if a node table has an ART index.
Sourcepub fn drop_rel_table(&self, name: &str) -> bool
pub fn drop_rel_table(&self, name: &str) -> bool
Remove a rel table by name. Returns true if the table existed.
Trait Implementations§
Source§impl Debug for TableCatalog
impl Debug for TableCatalog
Source§impl Default for TableCatalog
impl Default for TableCatalog
Source§fn default() -> TableCatalog
fn default() -> TableCatalog
Auto Trait Implementations§
impl !Freeze for TableCatalog
impl !RefUnwindSafe for TableCatalog
impl Send for TableCatalog
impl Sync for TableCatalog
impl Unpin for TableCatalog
impl UnsafeUnpin for TableCatalog
impl UnwindSafe for TableCatalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more