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