StorageNamespace

Trait StorageNamespace 

Source
pub trait StorageNamespace:
    Send
    + Sync
    + 'static {
    type Pager: Pager<Blob = EntryHandle> + Send + Sync + 'static;

    // Required methods
    fn namespace_id(&self) -> &NamespaceId;
    fn context(&self) -> Arc<RuntimeContext<Self::Pager>>;
    fn create_table(
        &self,
        plan: CreateTablePlan,
    ) -> Result<RuntimeStatementResult<Self::Pager>>;
    fn drop_table(&self, name: &str, if_exists: bool) -> Result<()>;
    fn create_index(
        &self,
        plan: CreateIndexPlan,
    ) -> Result<RuntimeStatementResult<Self::Pager>>;
    fn lookup_table(
        &self,
        canonical: &str,
    ) -> Result<Arc<ExecutorTable<Self::Pager>>>;
    fn list_tables(&self) -> Vec<String>;

    // Provided methods
    fn execute_operation(
        &self,
        operation: PlanOperation,
    ) -> Result<TransactionResult<Self::Pager>> { ... }
    fn owns_table(&self, canonical: &str) -> bool { ... }
}
Expand description

Trait implemented by all runtime storage namespaces.

Each namespace encapsulates a single storage backend (pager + catalog + table cache). Namespaces expose a minimal API so higher layers (RuntimeSession, SQL engine) can route operations without hard-coding per-namespace logic.

Required Associated Types§

Source

type Pager: Pager<Blob = EntryHandle> + Send + Sync + 'static

Required Methods§

Source

fn namespace_id(&self) -> &NamespaceId

Identifier used when resolving schemas (e.g. “main”, “temp”).

Source

fn context(&self) -> Arc<RuntimeContext<Self::Pager>>

Returns the runtime context bound to this namespace.

Source

fn create_table( &self, plan: CreateTablePlan, ) -> Result<RuntimeStatementResult<Self::Pager>>

Create a table inside this namespace.

Source

fn drop_table(&self, name: &str, if_exists: bool) -> Result<()>

Drop a table from this namespace.

Source

fn create_index( &self, plan: CreateIndexPlan, ) -> Result<RuntimeStatementResult<Self::Pager>>

Create an index inside this namespace.

Source

fn lookup_table( &self, canonical: &str, ) -> Result<Arc<ExecutorTable<Self::Pager>>>

Lookup a table by canonical name.

Source

fn list_tables(&self) -> Vec<String>

List tables visible to this namespace.

Provided Methods§

Source

fn execute_operation( &self, operation: PlanOperation, ) -> Result<TransactionResult<Self::Pager>>

Execute a generic plan operation. Namespaces that do not yet support this entry point should rely on the default error implementation.

Source

fn owns_table(&self, canonical: &str) -> bool

Returns true if the namespace owns (and should answer for) the canonical table name.

Implementors§

Source§

impl<P> StorageNamespace for PersistentNamespace<P>
where P: Pager<Blob = EntryHandle> + Send + Sync + 'static,

Source§

type Pager = P

Source§

impl<P> StorageNamespace for TemporaryNamespace<P>
where P: Pager<Blob = EntryHandle> + Send + Sync + 'static,

Source§

type Pager = P