pub struct SysCatalog<'a, P = MemPager>{ /* private fields */ }Expand description
Interface to the system catalog (table 0).
The system catalog stores metadata about all tables and columns in the database.
It uses special reserved columns within table 0 to persist TableMeta and
ColMeta structures.
§Lifetime
SysCatalog borrows a reference to the ColumnStore and does not own it.
This allows multiple catalog instances to coexist with the same storage.
Implementations§
Source§impl<'a, P> SysCatalog<'a, P>
impl<'a, P> SysCatalog<'a, P>
Sourcepub fn new(store: &'a ColumnStore<P>) -> Self
pub fn new(store: &'a ColumnStore<P>) -> Self
Create a new system catalog interface using the provided column store.
Sourcepub fn put_table_meta(&self, meta: &TableMeta)
pub fn put_table_meta(&self, meta: &TableMeta)
Insert or update table metadata.
This persists the table’s metadata to the system catalog. If metadata for this table ID already exists, it is overwritten (last-write-wins).
Sourcepub fn get_table_meta(&self, table_id: TableId) -> Option<TableMeta>
pub fn get_table_meta(&self, table_id: TableId) -> Option<TableMeta>
Retrieve table metadata by table ID.
Returns None if no metadata exists for the given table ID.
Sourcepub fn put_col_meta(&self, table_id: TableId, meta: &ColMeta)
pub fn put_col_meta(&self, table_id: TableId, meta: &ColMeta)
Upsert a single column’s metadata.
Sourcepub fn get_cols_meta(
&self,
table_id: TableId,
col_ids: &[u32],
) -> Vec<Option<ColMeta>>
pub fn get_cols_meta( &self, table_id: TableId, col_ids: &[u32], ) -> Vec<Option<ColMeta>>
Batch fetch specific column metas by col_id using a shared keyset.
Sourcepub fn delete_col_meta(
&self,
table_id: TableId,
col_ids: &[FieldId],
) -> LlkvResult<()>
pub fn delete_col_meta( &self, table_id: TableId, col_ids: &[FieldId], ) -> LlkvResult<()>
Delete metadata rows for the specified column identifiers.
Sourcepub fn delete_table_meta(&self, table_id: TableId) -> LlkvResult<()>
pub fn delete_table_meta(&self, table_id: TableId) -> LlkvResult<()>
Remove the persisted table metadata record, if present.
Sourcepub fn delete_constraint_records(
&self,
table_id: TableId,
constraint_ids: &[ConstraintId],
) -> LlkvResult<()>
pub fn delete_constraint_records( &self, table_id: TableId, constraint_ids: &[ConstraintId], ) -> LlkvResult<()>
Delete constraint records for the provided identifiers.
Sourcepub fn delete_constraint_names(
&self,
table_id: TableId,
constraint_ids: &[ConstraintId],
) -> LlkvResult<()>
pub fn delete_constraint_names( &self, table_id: TableId, constraint_ids: &[ConstraintId], ) -> LlkvResult<()>
Delete persisted constraint names for the provided identifiers.
Sourcepub fn delete_multi_column_uniques(&self, table_id: TableId) -> LlkvResult<()>
pub fn delete_multi_column_uniques(&self, table_id: TableId) -> LlkvResult<()>
Delete the multi-column UNIQUE metadata record for a table, if any.
Sourcepub fn put_multi_column_uniques(
&self,
table_id: TableId,
uniques: &[MultiColumnUniqueEntryMeta],
) -> LlkvResult<()>
pub fn put_multi_column_uniques( &self, table_id: TableId, uniques: &[MultiColumnUniqueEntryMeta], ) -> LlkvResult<()>
Persist the complete set of multi-column UNIQUE definitions for a table.
Sourcepub fn get_multi_column_uniques(
&self,
table_id: TableId,
) -> LlkvResult<Vec<MultiColumnUniqueEntryMeta>>
pub fn get_multi_column_uniques( &self, table_id: TableId, ) -> LlkvResult<Vec<MultiColumnUniqueEntryMeta>>
Retrieve all persisted multi-column UNIQUE definitions for a table.
Sourcepub fn all_multi_column_unique_metas(
&self,
) -> LlkvResult<Vec<TableMultiColumnUniqueMeta>>
pub fn all_multi_column_unique_metas( &self, ) -> LlkvResult<Vec<TableMultiColumnUniqueMeta>>
Retrieve all persisted multi-column UNIQUE definitions across tables.
Sourcepub fn put_constraint_records(
&self,
table_id: TableId,
records: &[ConstraintRecord],
) -> LlkvResult<()>
pub fn put_constraint_records( &self, table_id: TableId, records: &[ConstraintRecord], ) -> LlkvResult<()>
Persist or update multiple constraint records for a table in a single batch.
Sourcepub fn put_constraint_names(
&self,
table_id: TableId,
names: &[ConstraintNameRecord],
) -> LlkvResult<()>
pub fn put_constraint_names( &self, table_id: TableId, names: &[ConstraintNameRecord], ) -> LlkvResult<()>
Persist or update constraint names for the specified identifiers.
Sourcepub fn get_constraint_records(
&self,
table_id: TableId,
constraint_ids: &[ConstraintId],
) -> LlkvResult<Vec<Option<ConstraintRecord>>>
pub fn get_constraint_records( &self, table_id: TableId, constraint_ids: &[ConstraintId], ) -> LlkvResult<Vec<Option<ConstraintRecord>>>
Fetch multiple constraint records for a table in a single batch.
Sourcepub fn get_constraint_names(
&self,
table_id: TableId,
constraint_ids: &[ConstraintId],
) -> LlkvResult<Vec<Option<String>>>
pub fn get_constraint_names( &self, table_id: TableId, constraint_ids: &[ConstraintId], ) -> LlkvResult<Vec<Option<String>>>
Fetch constraint names for a table in a single batch.
Sourcepub fn scan_constraint_records_for_table<F>(
&self,
table_id: TableId,
on_batch: F,
) -> LlkvResult<()>
pub fn scan_constraint_records_for_table<F>( &self, table_id: TableId, on_batch: F, ) -> LlkvResult<()>
Stream constraint records for a table in batches.
Sourcepub fn constraint_records_for_table(
&self,
table_id: TableId,
) -> LlkvResult<Vec<ConstraintRecord>>
pub fn constraint_records_for_table( &self, table_id: TableId, ) -> LlkvResult<Vec<ConstraintRecord>>
Load all constraint records for a table into a vector.
pub fn put_next_table_id(&self, next_id: TableId) -> LlkvResult<()>
pub fn get_next_table_id(&self) -> LlkvResult<Option<TableId>>
pub fn max_table_id(&self) -> LlkvResult<Option<TableId>>
Sourcepub fn all_table_metas(&self) -> LlkvResult<Vec<(TableId, TableMeta)>>
pub fn all_table_metas(&self) -> LlkvResult<Vec<(TableId, TableMeta)>>
Scan all table metadata entries from the catalog. Returns a vector of (table_id, TableMeta) pairs for all persisted tables.
This method first scans for all row IDs in the table metadata column, then uses gather_rows to retrieve the actual metadata.
Sourcepub fn put_next_txn_id(&self, next_txn_id: u64) -> LlkvResult<()>
pub fn put_next_txn_id(&self, next_txn_id: u64) -> LlkvResult<()>
Persist the next transaction id to the catalog.
Sourcepub fn get_next_txn_id(&self) -> LlkvResult<Option<u64>>
pub fn get_next_txn_id(&self) -> LlkvResult<Option<u64>>
Load the next transaction id from the catalog.
Sourcepub fn put_last_committed_txn_id(&self, last_committed: u64) -> LlkvResult<()>
pub fn put_last_committed_txn_id(&self, last_committed: u64) -> LlkvResult<()>
Persist the last committed transaction id to the catalog.
Sourcepub fn get_last_committed_txn_id(&self) -> LlkvResult<Option<u64>>
pub fn get_last_committed_txn_id(&self) -> LlkvResult<Option<u64>>
Load the last committed transaction id from the catalog.
Sourcepub fn put_catalog_state(&self, state: &TableCatalogState) -> LlkvResult<()>
pub fn put_catalog_state(&self, state: &TableCatalogState) -> LlkvResult<()>
Persist the catalog state to the system catalog.
Stores the complete catalog state (all tables and fields) as a binary blob using bitcode serialization.
Sourcepub fn get_catalog_state(&self) -> LlkvResult<Option<TableCatalogState>>
pub fn get_catalog_state(&self) -> LlkvResult<Option<TableCatalogState>>
Load the catalog state from the system catalog.
Retrieves the complete catalog state including all table and field mappings.
Sourcepub fn put_schema_meta(&self, meta: &SchemaMeta) -> LlkvResult<()>
pub fn put_schema_meta(&self, meta: &SchemaMeta) -> LlkvResult<()>
Persist schema metadata to the catalog.
Stores schema metadata at a row ID derived from the schema name hash. This allows efficient lookup and prevents collisions.
Sourcepub fn get_schema_meta(
&self,
schema_name: &str,
) -> LlkvResult<Option<SchemaMeta>>
pub fn get_schema_meta( &self, schema_name: &str, ) -> LlkvResult<Option<SchemaMeta>>
Retrieve schema metadata by name.
Returns None if the schema does not exist.
Sourcepub fn all_schema_metas(&self) -> LlkvResult<Vec<SchemaMeta>>
pub fn all_schema_metas(&self) -> LlkvResult<Vec<SchemaMeta>>
Scan all schema metadata entries from the catalog.
Returns a vector of all persisted schemas.
Auto Trait Implementations§
impl<'a, P> Freeze for SysCatalog<'a, P>
impl<'a, P> RefUnwindSafe for SysCatalog<'a, P>where
P: RefUnwindSafe,
impl<'a, P> Send for SysCatalog<'a, P>
impl<'a, P> Sync for SysCatalog<'a, P>
impl<'a, P> Unpin for SysCatalog<'a, P>
impl<'a, P> UnwindSafe for SysCatalog<'a, P>where
P: RefUnwindSafe,
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
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