pub struct MetadataManager<P>{ /* private fields */ }Expand description
Central metadata facade that hides the raw catalog implementation details.
Implementations§
Source§impl<P> MetadataManager<P>
impl<P> MetadataManager<P>
Sourcepub fn new(store: Arc<ColumnStore<P>>) -> Self
pub fn new(store: Arc<ColumnStore<P>>) -> Self
Create a new metadata manager backed by the provided column store.
Sourcepub fn table_meta(&self, table_id: TableId) -> LlkvResult<Option<TableMeta>>
pub fn table_meta(&self, table_id: TableId) -> LlkvResult<Option<TableMeta>>
Retrieve the current table metadata snapshot (loaded lazily if required).
Sourcepub fn foreign_keys_referencing(
&self,
referenced_table: TableId,
) -> LlkvResult<Vec<(TableId, ConstraintId)>>
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.
Sourcepub fn set_table_meta(
&self,
table_id: TableId,
meta: TableMeta,
) -> LlkvResult<()>
pub fn set_table_meta( &self, table_id: TableId, meta: TableMeta, ) -> LlkvResult<()>
Update the in-memory table metadata. Changes are flushed on demand.
Sourcepub fn column_metas(
&self,
table_id: TableId,
field_ids: &[FieldId],
) -> LlkvResult<Vec<Option<ColMeta>>>
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.
Sourcepub fn set_column_meta(
&self,
table_id: TableId,
meta: ColMeta,
) -> LlkvResult<()>
pub fn set_column_meta( &self, table_id: TableId, meta: ColMeta, ) -> LlkvResult<()>
Upsert a single column metadata record in the in-memory snapshot.
Sourcepub fn multi_column_uniques(
&self,
table_id: TableId,
) -> LlkvResult<Vec<MultiColumnIndexEntryMeta>>
pub fn multi_column_uniques( &self, table_id: TableId, ) -> LlkvResult<Vec<MultiColumnIndexEntryMeta>>
Return the multi-column UNIQUE definitions cached for the table.
Sourcepub fn set_multi_column_uniques(
&self,
table_id: TableId,
uniques: Vec<MultiColumnIndexEntryMeta>,
) -> LlkvResult<()>
pub fn set_multi_column_uniques( &self, table_id: TableId, uniques: Vec<MultiColumnIndexEntryMeta>, ) -> LlkvResult<()>
Replace the cached multi-column UNIQUE definitions for the table.
Sourcepub fn single_column_indexes(
&self,
table_id: TableId,
) -> LlkvResult<Vec<SingleColumnIndexEntry>>
pub fn single_column_indexes( &self, table_id: TableId, ) -> LlkvResult<Vec<SingleColumnIndexEntry>>
Return the named single-column indexes registered for a table.
Sourcepub fn single_column_index(
&self,
table_id: TableId,
canonical_index_name: &str,
) -> LlkvResult<Option<SingleColumnIndexEntry>>
pub fn single_column_index( &self, table_id: TableId, canonical_index_name: &str, ) -> LlkvResult<Option<SingleColumnIndexEntry>>
Lookup a single-column index by canonical name.
Sourcepub fn put_single_column_index(
&self,
table_id: TableId,
entry: SingleColumnIndexEntry,
) -> LlkvResult<()>
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.
Sourcepub fn remove_single_column_index(
&self,
table_id: TableId,
canonical_index_name: &str,
) -> LlkvResult<Option<SingleColumnIndexEntry>>
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.
Sourcepub fn put_multi_column_index(
&self,
table_id: TableId,
entry: MultiColumnIndexEntryMeta,
) -> LlkvResult<()>
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.
Sourcepub fn remove_multi_column_index(
&self,
table_id: TableId,
canonical_index_name: &str,
) -> LlkvResult<Option<MultiColumnIndexEntryMeta>>
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.
Sourcepub fn get_multi_column_index(
&self,
table_id: TableId,
canonical_index_name: &str,
) -> LlkvResult<Option<MultiColumnIndexEntryMeta>>
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.
Sourcepub fn register_sort_index(
&self,
table_id: TableId,
field_id: FieldId,
) -> LlkvResult<()>
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.
Sourcepub fn unregister_sort_index(
&self,
table_id: TableId,
field_id: FieldId,
) -> LlkvResult<()>
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.
Sourcepub fn update_multi_column_uniques<F, T>(
&self,
table_id: TableId,
f: F,
) -> LlkvResult<T>
pub fn update_multi_column_uniques<F, T>( &self, table_id: TableId, f: F, ) -> LlkvResult<T>
Mutate the cached multi-column UNIQUE definitions for a table in-place.
Sourcepub fn triggers(&self, table_id: TableId) -> LlkvResult<Vec<TriggerEntryMeta>>
pub fn triggers(&self, table_id: TableId) -> LlkvResult<Vec<TriggerEntryMeta>>
Return the trigger definitions cached for the table.
Sourcepub fn trigger(
&self,
table_id: TableId,
canonical_name: &str,
) -> LlkvResult<Option<TriggerEntryMeta>>
pub fn trigger( &self, table_id: TableId, canonical_name: &str, ) -> LlkvResult<Option<TriggerEntryMeta>>
Fetch a trigger definition by its canonical name.
Sourcepub fn insert_trigger(
&self,
table_id: TableId,
trigger: TriggerEntryMeta,
) -> LlkvResult<()>
pub fn insert_trigger( &self, table_id: TableId, trigger: TriggerEntryMeta, ) -> LlkvResult<()>
Insert or replace a trigger definition in the cached snapshot.
Sourcepub fn remove_trigger(
&self,
table_id: TableId,
canonical_name: &str,
) -> LlkvResult<bool>
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.
Sourcepub fn prepare_table_drop(
&self,
table_id: TableId,
column_ids: &[FieldId],
) -> LlkvResult<()>
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.
Sourcepub fn remove_table_state(&self, table_id: TableId)
pub fn remove_table_state(&self, table_id: TableId)
Remove any cached snapshots for the specified table.
Sourcepub fn constraint_records(
&self,
table_id: TableId,
) -> LlkvResult<Vec<ConstraintRecord>>
pub fn constraint_records( &self, table_id: TableId, ) -> LlkvResult<Vec<ConstraintRecord>>
Return all constraint records currently cached for the table.
Sourcepub fn constraint_names(
&self,
table_id: TableId,
) -> LlkvResult<FxHashMap<ConstraintId, String>>
pub fn constraint_names( &self, table_id: TableId, ) -> LlkvResult<FxHashMap<ConstraintId, String>>
Return the map of constraint names keyed by identifier for the table.
Sourcepub fn constraint_records_by_id(
&self,
table_id: TableId,
constraint_ids: &[ConstraintId],
) -> LlkvResult<Vec<Option<ConstraintRecord>>>
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.
Sourcepub fn put_constraint_records(
&self,
table_id: TableId,
records: &[ConstraintRecord],
) -> LlkvResult<()>
pub fn put_constraint_records( &self, table_id: TableId, records: &[ConstraintRecord], ) -> LlkvResult<()>
Upsert constraint records in the in-memory snapshot.
Sourcepub fn put_constraint_names(
&self,
table_id: TableId,
names: &[(ConstraintId, Option<String>)],
) -> LlkvResult<()>
pub fn put_constraint_names( &self, table_id: TableId, names: &[(ConstraintId, Option<String>)], ) -> LlkvResult<()>
Upsert constraint names in the in-memory snapshot.
Sourcepub fn constraint_record_map(
&self,
table_id: TableId,
) -> LlkvResult<FxHashMap<ConstraintId, ConstraintRecord>>
pub fn constraint_record_map( &self, table_id: TableId, ) -> LlkvResult<FxHashMap<ConstraintId, ConstraintRecord>>
Produce a map of constraint records keyed by identifier.
Sourcepub fn flush_table(&self, table_id: TableId) -> LlkvResult<()>
pub fn flush_table(&self, table_id: TableId) -> LlkvResult<()>
Persist changes for a single table to the underlying catalog, writing only the diffs.
Sourcepub fn flush_all(&self) -> LlkvResult<()>
pub fn flush_all(&self) -> LlkvResult<()>
Persist changes for all tracked tables.
Sourcepub fn all_table_metas(&self) -> LlkvResult<Vec<(TableId, TableMeta)>>
pub fn all_table_metas(&self) -> LlkvResult<Vec<(TableId, TableMeta)>>
Return all persisted table metadata.
Sourcepub fn all_multi_column_unique_metas(
&self,
) -> LlkvResult<Vec<TableMultiColumnIndexMeta>>
pub fn all_multi_column_unique_metas( &self, ) -> LlkvResult<Vec<TableMultiColumnIndexMeta>>
Return all persisted multi-column unique metadata.
Sourcepub fn foreign_key_descriptors(
&self,
table_id: TableId,
) -> LlkvResult<Vec<ForeignKeyDescriptor>>
pub fn foreign_key_descriptors( &self, table_id: TableId, ) -> LlkvResult<Vec<ForeignKeyDescriptor>>
Assemble foreign key descriptors for the table using cached metadata.
Sourcepub fn foreign_key_views(
&self,
catalog: &TableCatalog,
table_id: TableId,
) -> LlkvResult<Vec<ForeignKeyView>>
pub fn foreign_key_views( &self, catalog: &TableCatalog, table_id: TableId, ) -> LlkvResult<Vec<ForeignKeyView>>
Resolve foreign key descriptors into names suitable for runtime consumers.
Sourcepub fn table_view(
&self,
catalog: &TableCatalog,
table_id: TableId,
field_ids: &[FieldId],
) -> LlkvResult<TableView>
pub fn table_view( &self, catalog: &TableCatalog, table_id: TableId, field_ids: &[FieldId], ) -> LlkvResult<TableView>
Assemble a consolidated read-only view of table metadata.
Sourcepub fn validate_and_register_foreign_keys<F>(
&self,
referencing_table: &ForeignKeyTableInfo,
specs: &[ForeignKeySpec],
lookup_table: F,
timestamp_micros: u64,
) -> LlkvResult<Vec<ValidatedForeignKey>>
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.
Sourcepub fn register_foreign_keys(
&self,
table_id: TableId,
foreign_keys: &[ValidatedForeignKey],
timestamp_micros: u64,
) -> LlkvResult<()>
pub fn register_foreign_keys( &self, table_id: TableId, foreign_keys: &[ValidatedForeignKey], timestamp_micros: u64, ) -> LlkvResult<()>
Register validated foreign key definitions for a table.
Sourcepub fn apply_column_definitions(
&self,
table_id: TableId,
columns: &[TableColumn],
timestamp_micros: u64,
) -> LlkvResult<()>
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.
pub fn column_data_type( &self, table_id: TableId, field_id: FieldId, ) -> LlkvResult<DataType>
Sourcepub fn register_multi_column_unique(
&self,
table_id: TableId,
column_ids: &[FieldId],
index_name: Option<String>,
) -> LlkvResult<MultiColumnUniqueRegistration>
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.
Sourcepub fn reserve_table_id(&self) -> LlkvResult<TableId>
pub fn reserve_table_id(&self) -> LlkvResult<TableId>
Reserve and return the next available table id.
Sourcepub fn ensure_next_table_id_at_least(&self, minimum: TableId) -> LlkvResult<()>
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> 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