Skip to main content

TableCatalog

Struct TableCatalog 

Source
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

Source

pub fn new() -> Self

Source

pub fn set_db_path(&self, path: PathBuf)

Record the database’s filesystem root (called by crate::StorageManager::new). Last write wins.

Source

pub fn db_path(&self) -> Option<PathBuf>

The database’s filesystem root, if known. None for in-memory or standalone catalogs.

Source

pub fn fts_runtime_handle( &self, name: &str, ) -> Option<Arc<dyn Any + Send + Sync>>

Get the runtime handle registered for side-car index name (FTS, P107.2), if any. The value is type-erased; the owning crate downcasts it via [std::any::Any::downcast_arc].

Source

pub fn set_fts_runtime_handle( &self, name: &str, handle: Arc<dyn Any + Send + Sync>, )

Register (or replace) the runtime handle for side-car index name.

Used by the FTS extension to make the commit-time sync hook and the read scans share ONE live IndexReader (reloaded only at commit, P107.2).

Source

pub fn create_node_table( &self, name: String, columns: Vec<ColumnDefinition>, ) -> NodeTable

Source

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.

Source

pub fn create_rel_table( &self, name: String, src_table_id: u64, dst_table_id: u64, columns: Vec<ColumnDefinition>, ) -> RelTable

Source

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.

Source

pub fn get_node_table(&self, table_id: u64) -> Option<Ref<'_, u64, NodeTable>>

Source

pub fn get_node_table_mut( &self, table_id: u64, ) -> Option<RefMut<'_, u64, NodeTable>>

Source

pub fn get_node_table_by_name( &self, name: &str, ) -> Option<Ref<'_, u64, NodeTable>>

Source

pub fn get_node_table_by_name_mut( &self, name: &str, ) -> Option<RefMut<'_, u64, NodeTable>>

Source

pub fn get_rel_table(&self, table_id: u64) -> Option<Ref<'_, u64, RelTable>>

Source

pub fn get_rel_table_mut( &self, table_id: u64, ) -> Option<RefMut<'_, u64, RelTable>>

Source

pub fn get_rel_table_by_name( &self, name: &str, ) -> Option<Ref<'_, u64, RelTable>>

Source

pub fn get_rel_table_by_name_mut( &self, name: &str, ) -> Option<RefMut<'_, u64, RelTable>>

Source

pub fn has_incident_edges(&self, table_id: u64, node_idx: u64) -> bool

Check if a node has any incident edges.

Source

pub fn detach_node(&self, table_id: u64, node_idx: u64)

Delete all incident edges for a given node.

Source

pub fn all_node_tables(&self) -> Vec<RefMulti<'_, u64, NodeTable>>

Source

pub fn all_rel_tables(&self) -> Vec<RefMulti<'_, u64, RelTable>>

Source

pub fn node_table_num_rows(&self, name: &str) -> u64

Get the number of rows in a node table by name.

Source

pub fn drop_node_table(&self, name: &str) -> bool

Remove a node table by name. Returns true if the table existed.

Source

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.

Source

pub fn get_vector_index( &self, index_id: u64, ) -> Option<Ref<'_, u64, VectorIndexTable>>

Get a vector index by its ID.

Source

pub fn get_vector_index_by_name( &self, name: &str, ) -> Option<Ref<'_, u64, VectorIndexTable>>

Get a vector index by name.

Source

pub fn get_vector_index_by_name_mut( &self, name: &str, ) -> Option<RefMut<'_, u64, VectorIndexTable>>

Get a mutable vector index by name.

Source

pub fn get_vector_index_mut( &self, index_id: u64, ) -> Option<RefMut<'_, u64, VectorIndexTable>>

Get a mutable vector index by ID.

Source

pub fn drop_vector_index(&self, name: &str) -> bool

Remove a vector index by name. Returns true if the index existed.

Source

pub fn all_vector_indexes(&self) -> Vec<RefMulti<'_, u64, VectorIndexTable>>

Get all vector indexes.

Source

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).

Source

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).

Source

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.

Source

pub fn drop_art_index(&self, table_name: &str) -> Result<(), StorageError>

Drop the ART index from a node table.

Source

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.

Source

pub fn has_art_index(&self, table_name: &str) -> bool

Check if a node table has an ART index.

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TableCatalog

Source§

fn default() -> TableCatalog

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more