pub struct PersistentCatalog<S: KVStore> { /* private fields */ }Expand description
永続カタログ実装。 永続化対応のカタログ実装。
§Examples
use std::sync::Arc;
use alopex_core::kv::memory::MemoryKV;
use alopex_sql::Catalog;
use alopex_sql::catalog::PersistentCatalog;
let store = Arc::new(MemoryKV::new());
let catalog = PersistentCatalog::new(store);
assert!(catalog.table_exists("users") == false);Implementations§
Source§impl<S: KVStore> PersistentCatalog<S>
impl<S: KVStore> PersistentCatalog<S>
pub fn load(store: Arc<S>) -> Result<Self, CatalogError>
pub fn new(store: Arc<S>) -> Self
pub fn store(&self) -> &Arc<S>
pub fn list_catalogs(&self) -> Vec<CatalogMeta> ⓘ
pub fn get_catalog(&self, name: &str) -> Option<CatalogMeta>
pub fn create_catalog(&mut self, meta: CatalogMeta) -> Result<(), CatalogError>
pub fn delete_catalog(&mut self, name: &str) -> Result<(), CatalogError>
pub fn list_namespaces(&self, catalog_name: &str) -> Vec<NamespaceMeta> ⓘ
pub fn get_namespace( &self, catalog_name: &str, namespace_name: &str, ) -> Option<NamespaceMeta>
pub fn create_namespace( &mut self, meta: NamespaceMeta, ) -> Result<(), CatalogError>
pub fn delete_namespace( &mut self, catalog_name: &str, namespace_name: &str, ) -> Result<(), CatalogError>
pub fn persist_create_table( &mut self, txn: &mut S::Transaction<'_>, table: &TableMetadata, ) -> Result<(), CatalogError>
pub fn persist_drop_table( &mut self, txn: &mut S::Transaction<'_>, fqn: &TableFqn, ) -> Result<(), CatalogError>
pub fn persist_create_index( &mut self, txn: &mut S::Transaction<'_>, index: &IndexMetadata, ) -> Result<(), CatalogError>
pub fn persist_drop_index( &mut self, txn: &mut S::Transaction<'_>, fqn: &IndexFqn, ) -> Result<(), CatalogError>
pub fn persist_overlay( &mut self, txn: &mut S::Transaction<'_>, overlay: &CatalogOverlay, ) -> Result<(), CatalogError>
pub fn get_catalog_in_txn<'a>( &'a self, name: &str, overlay: &'a CatalogOverlay, ) -> Option<&'a CatalogMeta>
pub fn get_namespace_in_txn<'a>( &'a self, catalog_name: &str, namespace_name: &str, overlay: &'a CatalogOverlay, ) -> Option<&'a NamespaceMeta>
pub fn list_catalogs_in_txn(&self, overlay: &CatalogOverlay) -> Vec<CatalogMeta> ⓘ
pub fn list_namespaces_in_txn( &self, catalog_name: &str, overlay: &CatalogOverlay, ) -> Vec<NamespaceMeta> ⓘ
pub fn table_exists_in_txn(&self, name: &str, overlay: &CatalogOverlay) -> bool
pub fn get_table_in_txn<'a>( &'a self, name: &str, overlay: &'a CatalogOverlay, ) -> Option<&'a TableMetadata>
pub fn index_exists_in_txn(&self, name: &str, overlay: &CatalogOverlay) -> bool
pub fn get_index_in_txn<'a>( &'a self, name: &str, overlay: &'a CatalogOverlay, ) -> Option<&'a IndexMetadata>
pub fn list_tables_in_txn( &self, catalog_name: &str, namespace_name: &str, overlay: &CatalogOverlay, ) -> Vec<TableMetadata>
pub fn list_indexes_in_txn( &self, fqn: &TableFqn, overlay: &CatalogOverlay, ) -> Vec<IndexMetadata>
pub fn apply_overlay(&mut self, overlay: CatalogOverlay)
pub fn discard_overlay(_overlay: CatalogOverlay)
Trait Implementations§
Source§impl<S: KVStore> Catalog for PersistentCatalog<S>
impl<S: KVStore> Catalog for PersistentCatalog<S>
Source§fn create_table(&mut self, table: TableMetadata) -> Result<(), PlannerError>
fn create_table(&mut self, table: TableMetadata) -> Result<(), PlannerError>
Create a new table in the catalog. Read more
Source§fn drop_table(&mut self, name: &str) -> Result<(), PlannerError>
fn drop_table(&mut self, name: &str) -> Result<(), PlannerError>
Drop a table from the catalog. Read more
Source§fn create_index(&mut self, index: IndexMetadata) -> Result<(), PlannerError>
fn create_index(&mut self, index: IndexMetadata) -> Result<(), PlannerError>
Create a new index in the catalog. Read more
Source§fn get_indexes_for_table(&self, table: &str) -> Vec<&IndexMetadata>
fn get_indexes_for_table(&self, table: &str) -> Vec<&IndexMetadata>
Get all indexes for a table. Read more
Source§fn drop_index(&mut self, name: &str) -> Result<(), PlannerError>
fn drop_index(&mut self, name: &str) -> Result<(), PlannerError>
Drop an index from the catalog. Read more
Source§fn table_exists(&self, name: &str) -> bool
fn table_exists(&self, name: &str) -> bool
Check if a table exists.
Source§fn index_exists(&self, name: &str) -> bool
fn index_exists(&self, name: &str) -> bool
Check if an index exists.
Source§fn next_table_id(&mut self) -> u32
fn next_table_id(&mut self) -> u32
Generate the next unique table ID. Read more
Source§fn next_index_id(&mut self) -> u32
fn next_index_id(&mut self) -> u32
Generate the next unique index ID. Read more
Auto Trait Implementations§
impl<S> Freeze for PersistentCatalog<S>
impl<S> RefUnwindSafe for PersistentCatalog<S>where
S: RefUnwindSafe,
impl<S> Send for PersistentCatalog<S>
impl<S> Sync for PersistentCatalog<S>
impl<S> Unpin for PersistentCatalog<S>
impl<S> UnwindSafe for PersistentCatalog<S>where
S: 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
Mutably borrows from an owned value. Read more