pub struct SchemaManager { /* private fields */ }Expand description
Manages table schemas in memory, backed by the _schema table.
Implementations§
Source§impl SchemaManager
impl SchemaManager
pub fn get(&self, name: &str) -> Option<&TableSchema>
pub fn contains(&self, name: &str) -> bool
pub fn generation(&self) -> u64
pub fn register(&mut self, schema: TableSchema)
pub fn remove(&mut self, name: &str) -> Option<TableSchema>
pub fn table_names(&self) -> Vec<&str>
Sourcepub fn all_schemas(&self) -> impl Iterator<Item = &TableSchema>
pub fn all_schemas(&self) -> impl Iterator<Item = &TableSchema>
Returns all table schemas.
pub fn get_view(&self, name: &str) -> Option<&ViewDef>
pub fn register_view(&mut self, view: ViewDef)
pub fn remove_view(&mut self, name: &str) -> Option<ViewDef>
pub fn view_names(&self) -> Vec<&str>
pub fn save_view(wtx: &mut WriteTxn<'_>, view: &ViewDef) -> Result<()>
pub fn delete_view(wtx: &mut WriteTxn<'_>, name: &str) -> Result<()>
pub fn ensure_views_table(wtx: &mut WriteTxn<'_>) -> Result<()>
Sourcepub fn child_fks_for(&self, parent: &str) -> Vec<(&str, &ForeignKeySchemaEntry)>
pub fn child_fks_for(&self, parent: &str) -> Vec<(&str, &ForeignKeySchemaEntry)>
Find all FKs in other tables that reference parent table.
Sourcepub fn save_schema(wtx: &mut WriteTxn<'_>, schema: &TableSchema) -> Result<()>
pub fn save_schema(wtx: &mut WriteTxn<'_>, schema: &TableSchema) -> Result<()>
Persist a schema to the _schema table (called within a write txn).
Sourcepub fn delete_schema(wtx: &mut WriteTxn<'_>, name: &str) -> Result<()>
pub fn delete_schema(wtx: &mut WriteTxn<'_>, name: &str) -> Result<()>
Remove a schema from the _schema table (called within a write txn).
Sourcepub fn ensure_schema_table(wtx: &mut WriteTxn<'_>) -> Result<()>
pub fn ensure_schema_table(wtx: &mut WriteTxn<'_>) -> Result<()>
Ensure the _schema table exists (called once per write).
pub fn save_snapshot(&self) -> SchemaSnapshot
pub fn restore_snapshot(&mut self, snap: SchemaSnapshot)
Auto Trait Implementations§
impl Freeze for SchemaManager
impl RefUnwindSafe for SchemaManager
impl Send for SchemaManager
impl Sync for SchemaManager
impl Unpin for SchemaManager
impl UnsafeUnpin for SchemaManager
impl UnwindSafe for SchemaManager
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
Mutably borrows from an owned value. Read more