PersistentCatalog

Struct PersistentCatalog 

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

Source

pub fn load(store: Arc<S>) -> Result<Self, CatalogError>

Source

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

Source

pub fn store(&self) -> &Arc<S>

Source

pub fn list_catalogs(&self) -> Vec<CatalogMeta>

Source

pub fn get_catalog(&self, name: &str) -> Option<CatalogMeta>

Source

pub fn create_catalog(&mut self, meta: CatalogMeta) -> Result<(), CatalogError>

Source

pub fn delete_catalog(&mut self, name: &str) -> Result<(), CatalogError>

Source

pub fn list_namespaces(&self, catalog_name: &str) -> Vec<NamespaceMeta>

Source

pub fn get_namespace( &self, catalog_name: &str, namespace_name: &str, ) -> Option<NamespaceMeta>

Source

pub fn create_namespace( &mut self, meta: NamespaceMeta, ) -> Result<(), CatalogError>

Source

pub fn delete_namespace( &mut self, catalog_name: &str, namespace_name: &str, ) -> Result<(), CatalogError>

Source

pub fn persist_create_table( &mut self, txn: &mut S::Transaction<'_>, table: &TableMetadata, ) -> Result<(), CatalogError>

Source

pub fn persist_drop_table( &mut self, txn: &mut S::Transaction<'_>, fqn: &TableFqn, ) -> Result<(), CatalogError>

Source

pub fn persist_create_index( &mut self, txn: &mut S::Transaction<'_>, index: &IndexMetadata, ) -> Result<(), CatalogError>

Source

pub fn persist_drop_index( &mut self, txn: &mut S::Transaction<'_>, fqn: &IndexFqn, ) -> Result<(), CatalogError>

Source

pub fn persist_overlay( &mut self, txn: &mut S::Transaction<'_>, overlay: &CatalogOverlay, ) -> Result<(), CatalogError>

Source

pub fn get_catalog_in_txn<'a>( &'a self, name: &str, overlay: &'a CatalogOverlay, ) -> Option<&'a CatalogMeta>

Source

pub fn get_namespace_in_txn<'a>( &'a self, catalog_name: &str, namespace_name: &str, overlay: &'a CatalogOverlay, ) -> Option<&'a NamespaceMeta>

Source

pub fn list_catalogs_in_txn(&self, overlay: &CatalogOverlay) -> Vec<CatalogMeta>

Source

pub fn list_namespaces_in_txn( &self, catalog_name: &str, overlay: &CatalogOverlay, ) -> Vec<NamespaceMeta>

Source

pub fn table_exists_in_txn(&self, name: &str, overlay: &CatalogOverlay) -> bool

Source

pub fn get_table_in_txn<'a>( &'a self, name: &str, overlay: &'a CatalogOverlay, ) -> Option<&'a TableMetadata>

Source

pub fn index_exists_in_txn(&self, name: &str, overlay: &CatalogOverlay) -> bool

Source

pub fn get_index_in_txn<'a>( &'a self, name: &str, overlay: &'a CatalogOverlay, ) -> Option<&'a IndexMetadata>

Source

pub fn list_tables_in_txn( &self, catalog_name: &str, namespace_name: &str, overlay: &CatalogOverlay, ) -> Vec<TableMetadata>

Source

pub fn list_indexes_in_txn( &self, fqn: &TableFqn, overlay: &CatalogOverlay, ) -> Vec<IndexMetadata>

Source

pub fn apply_overlay(&mut self, overlay: CatalogOverlay)

Source

pub fn discard_overlay(_overlay: CatalogOverlay)

Trait Implementations§

Source§

impl<S: KVStore> Catalog for PersistentCatalog<S>

Source§

fn create_table(&mut self, table: TableMetadata) -> Result<(), PlannerError>

Create a new table in the catalog. Read more
Source§

fn get_table(&self, name: &str) -> Option<&TableMetadata>

Get a table by name. Read more
Source§

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>

Create a new index in the catalog. Read more
Source§

fn get_index(&self, name: &str) -> Option<&IndexMetadata>

Get an index by name. Read more
Source§

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>

Drop an index from the catalog. Read more
Source§

fn table_exists(&self, name: &str) -> bool

Check if a table exists.
Source§

fn index_exists(&self, name: &str) -> bool

Check if an index exists.
Source§

fn next_table_id(&mut self) -> u32

Generate the next unique table ID. Read more
Source§

fn next_index_id(&mut self) -> u32

Generate the next unique index ID. Read more
Source§

impl<S: Debug + KVStore> Debug for PersistentCatalog<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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,