SysCatalog

Struct SysCatalog 

Source
pub struct SysCatalog<'a, P = MemPager>
where P: Pager<Blob = EntryHandle> + Send + Sync,
{ /* 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>
where P: Pager<Blob = EntryHandle> + Send + Sync,

Source

pub fn new(store: &'a ColumnStore<P>) -> Self

Create a new system catalog interface using the provided column store.

Source

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

Source

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.

Source

pub fn put_col_meta(&self, table_id: TableId, meta: &ColMeta)

Upsert a single column’s metadata.

Source

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.

Source

pub fn delete_col_meta( &self, table_id: TableId, col_ids: &[FieldId], ) -> LlkvResult<()>

Delete metadata rows for the specified column identifiers.

Source

pub fn delete_table_meta(&self, table_id: TableId) -> LlkvResult<()>

Remove the persisted table metadata record, if present.

Source

pub fn delete_constraint_records( &self, table_id: TableId, constraint_ids: &[ConstraintId], ) -> LlkvResult<()>

Delete constraint records for the provided identifiers.

Source

pub fn delete_constraint_names( &self, table_id: TableId, constraint_ids: &[ConstraintId], ) -> LlkvResult<()>

Delete persisted constraint names for the provided identifiers.

Source

pub fn delete_multi_column_uniques(&self, table_id: TableId) -> LlkvResult<()>

Delete the multi-column UNIQUE metadata record for a table, if any.

Source

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.

Source

pub fn get_multi_column_uniques( &self, table_id: TableId, ) -> LlkvResult<Vec<MultiColumnUniqueEntryMeta>>

Retrieve all persisted multi-column UNIQUE definitions for a table.

Source

pub fn all_multi_column_unique_metas( &self, ) -> LlkvResult<Vec<TableMultiColumnUniqueMeta>>

Retrieve all persisted multi-column UNIQUE definitions across tables.

Source

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.

Source

pub fn put_constraint_names( &self, table_id: TableId, names: &[ConstraintNameRecord], ) -> LlkvResult<()>

Persist or update constraint names for the specified identifiers.

Source

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.

Source

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.

Source

pub fn scan_constraint_records_for_table<F>( &self, table_id: TableId, on_batch: F, ) -> LlkvResult<()>

Stream constraint records for a table in batches.

Source

pub fn constraint_records_for_table( &self, table_id: TableId, ) -> LlkvResult<Vec<ConstraintRecord>>

Load all constraint records for a table into a vector.

Source

pub fn put_next_table_id(&self, next_id: TableId) -> LlkvResult<()>

Source

pub fn get_next_table_id(&self) -> LlkvResult<Option<TableId>>

Source

pub fn max_table_id(&self) -> LlkvResult<Option<TableId>>

Source

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.

Source

pub fn put_next_txn_id(&self, next_txn_id: u64) -> LlkvResult<()>

Persist the next transaction id to the catalog.

Source

pub fn get_next_txn_id(&self) -> LlkvResult<Option<u64>>

Load the next transaction id from the catalog.

Source

pub fn put_last_committed_txn_id(&self, last_committed: u64) -> LlkvResult<()>

Persist the last committed transaction id to the catalog.

Source

pub fn get_last_committed_txn_id(&self) -> LlkvResult<Option<u64>>

Load the last committed transaction id from the catalog.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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> 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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,