MetadataManager

Struct MetadataManager 

Source
pub struct MetadataManager<P>
where P: Pager<Blob = EntryHandle> + Send + Sync,
{ /* private fields */ }
Expand description

Central metadata facade that hides the raw catalog implementation details.

Implementations§

Source§

impl<P> MetadataManager<P>
where P: Pager<Blob = EntryHandle> + Send + Sync,

Source

pub fn new(store: Arc<ColumnStore<P>>) -> Self

Create a new metadata manager backed by the provided column store.

Source

pub fn table_meta(&self, table_id: TableId) -> LlkvResult<Option<TableMeta>>

Retrieve the current table metadata snapshot (loaded lazily if required).

Source

pub fn foreign_keys_referencing( &self, referenced_table: TableId, ) -> LlkvResult<Vec<(TableId, ConstraintId)>>

Return the list of child table + constraint identifiers that reference the provided table.

Source

pub fn set_table_meta( &self, table_id: TableId, meta: TableMeta, ) -> LlkvResult<()>

Update the in-memory table metadata. Changes are flushed on demand.

Source

pub fn column_metas( &self, table_id: TableId, field_ids: &[FieldId], ) -> LlkvResult<Vec<Option<ColMeta>>>

Fetch column metadata for the requested field identifiers, loading missing entries lazily.

Source

pub fn set_column_meta( &self, table_id: TableId, meta: ColMeta, ) -> LlkvResult<()>

Upsert a single column metadata record in the in-memory snapshot.

Source

pub fn multi_column_uniques( &self, table_id: TableId, ) -> LlkvResult<Vec<MultiColumnIndexEntryMeta>>

Return the multi-column UNIQUE definitions cached for the table.

Source

pub fn set_multi_column_uniques( &self, table_id: TableId, uniques: Vec<MultiColumnIndexEntryMeta>, ) -> LlkvResult<()>

Replace the cached multi-column UNIQUE definitions for the table.

Source

pub fn single_column_indexes( &self, table_id: TableId, ) -> LlkvResult<Vec<SingleColumnIndexEntry>>

Return the named single-column indexes registered for a table.

Source

pub fn single_column_index( &self, table_id: TableId, canonical_index_name: &str, ) -> LlkvResult<Option<SingleColumnIndexEntry>>

Lookup a single-column index by canonical name.

Source

pub fn put_single_column_index( &self, table_id: TableId, entry: SingleColumnIndexEntry, ) -> LlkvResult<()>

Register or replace a single-column index metadata entry in the cached snapshot.

Source

pub fn remove_single_column_index( &self, table_id: TableId, canonical_index_name: &str, ) -> LlkvResult<Option<SingleColumnIndexEntry>>

Remove a single-column index metadata entry from the cached snapshot.

Source

pub fn put_multi_column_index( &self, table_id: TableId, entry: MultiColumnIndexEntryMeta, ) -> LlkvResult<()>

Register or replace a multi-column index metadata entry in the cached snapshot.

Source

pub fn remove_multi_column_index( &self, table_id: TableId, canonical_index_name: &str, ) -> LlkvResult<Option<MultiColumnIndexEntryMeta>>

Remove a multi-column index metadata entry from the cached snapshot.

Source

pub fn get_multi_column_index( &self, table_id: TableId, canonical_index_name: &str, ) -> LlkvResult<Option<MultiColumnIndexEntryMeta>>

Retrieve a multi-column index metadata entry by canonical name.

Source

pub fn register_sort_index( &self, table_id: TableId, field_id: FieldId, ) -> LlkvResult<()>

Register a sort index for a column at the metadata level, staging the change for the next flush.

Source

pub fn unregister_sort_index( &self, table_id: TableId, field_id: FieldId, ) -> LlkvResult<()>

Unregister a sort index for a column, staging removal for the next flush.

Source

pub fn update_multi_column_uniques<F, T>( &self, table_id: TableId, f: F, ) -> LlkvResult<T>
where F: FnOnce(&mut Vec<MultiColumnIndexEntryMeta>) -> T,

Mutate the cached multi-column UNIQUE definitions for a table in-place.

Source

pub fn triggers(&self, table_id: TableId) -> LlkvResult<Vec<TriggerEntryMeta>>

Return the trigger definitions cached for the table.

Source

pub fn trigger( &self, table_id: TableId, canonical_name: &str, ) -> LlkvResult<Option<TriggerEntryMeta>>

Fetch a trigger definition by its canonical name.

Source

pub fn insert_trigger( &self, table_id: TableId, trigger: TriggerEntryMeta, ) -> LlkvResult<()>

Insert or replace a trigger definition in the cached snapshot.

Source

pub fn remove_trigger( &self, table_id: TableId, canonical_name: &str, ) -> LlkvResult<bool>

Remove a trigger definition by canonical name. Returns true when the trigger existed.

Source

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

Prepare the metadata state for dropping a table by clearing cached entries.

Column metadata is loaded eagerly for the provided field identifiers so deletions are persisted on the next flush.

Source

pub fn remove_table_state(&self, table_id: TableId)

Remove any cached snapshots for the specified table.

Source

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

Return all constraint records currently cached for the table.

Source

pub fn constraint_names( &self, table_id: TableId, ) -> LlkvResult<FxHashMap<ConstraintId, String>>

Return the map of constraint names keyed by identifier for the table.

Source

pub fn constraint_records_by_id( &self, table_id: TableId, constraint_ids: &[ConstraintId], ) -> LlkvResult<Vec<Option<ConstraintRecord>>>

Fetch a subset of constraint records by their identifiers.

Source

pub fn put_constraint_records( &self, table_id: TableId, records: &[ConstraintRecord], ) -> LlkvResult<()>

Upsert constraint records in the in-memory snapshot.

Source

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

Upsert constraint names in the in-memory snapshot.

Source

pub fn constraint_record_map( &self, table_id: TableId, ) -> LlkvResult<FxHashMap<ConstraintId, ConstraintRecord>>

Produce a map of constraint records keyed by identifier.

Source

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

Persist changes for a single table to the underlying catalog, writing only the diffs.

Source

pub fn flush_all(&self) -> LlkvResult<()>

Persist changes for all tracked tables.

Source

pub fn all_table_metas(&self) -> LlkvResult<Vec<(TableId, TableMeta)>>

Return all persisted table metadata.

Source

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

Return all persisted multi-column unique metadata.

Source

pub fn foreign_key_descriptors( &self, table_id: TableId, ) -> LlkvResult<Vec<ForeignKeyDescriptor>>

Assemble foreign key descriptors for the table using cached metadata.

Source

pub fn foreign_key_views( &self, catalog: &TableCatalog, table_id: TableId, ) -> LlkvResult<Vec<ForeignKeyView>>

Resolve foreign key descriptors into names suitable for runtime consumers.

Source

pub fn table_view( &self, catalog: &TableCatalog, table_id: TableId, field_ids: &[FieldId], ) -> LlkvResult<TableView>

Assemble a consolidated read-only view of table metadata.

Source

pub fn validate_and_register_foreign_keys<F>( &self, referencing_table: &ForeignKeyTableInfo, specs: &[ForeignKeySpec], lookup_table: F, timestamp_micros: u64, ) -> LlkvResult<Vec<ValidatedForeignKey>>

Validate foreign key specifications and persist them for the referencing table.

Source

pub fn register_foreign_keys( &self, table_id: TableId, foreign_keys: &[ValidatedForeignKey], timestamp_micros: u64, ) -> LlkvResult<()>

Register validated foreign key definitions for a table.

Source

pub fn apply_column_definitions( &self, table_id: TableId, columns: &[TableColumn], timestamp_micros: u64, ) -> LlkvResult<()>

Register column metadata, physical storage columns, and primary/unique constraints.

Source

pub fn column_data_type( &self, table_id: TableId, field_id: FieldId, ) -> LlkvResult<DataType>

Source

pub fn register_multi_column_unique( &self, table_id: TableId, column_ids: &[FieldId], index_name: Option<String>, ) -> LlkvResult<MultiColumnUniqueRegistration>

Register a multi-column UNIQUE definition for a table.

Source

pub fn reserve_table_id(&self) -> LlkvResult<TableId>

Reserve and return the next available table id.

Source

pub fn ensure_next_table_id_at_least(&self, minimum: TableId) -> LlkvResult<()>

Ensure the catalog’s next_table_id counter is at least minimum.

This is primarily used by in-memory namespaces (e.g., temporary tables) that share a catalog handle with persistent storage. By seeding their own metadata store with a higher starting point we avoid collisions on table IDs already allocated by the persistent catalog.

Auto Trait Implementations§

§

impl<P> !Freeze for MetadataManager<P>

§

impl<P> RefUnwindSafe for MetadataManager<P>
where P: RefUnwindSafe,

§

impl<P> Send for MetadataManager<P>

§

impl<P> Sync for MetadataManager<P>

§

impl<P> Unpin for MetadataManager<P>

§

impl<P> UnwindSafe for MetadataManager<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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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,