Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Lance format Lance LanceNamespaceTrait

From Leeroopedia
Revision as of 15:28, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Lance_format_Lance_LanceNamespaceTrait.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Namespace, Infrastructure
Last Updated 2026-02-08 19:33 GMT

Overview

Description

The LanceNamespace trait defines the base interface that all Lance namespace implementations must provide. It is an async_trait requiring Send + Sync + Debug, and it declares a comprehensive set of async methods covering namespace management, table lifecycle, data manipulation, indexing, tagging, transactions, and query planning.

Each method has a default implementation that returns Error::NotSupported, allowing backends to incrementally implement only the operations they support. The trait relies on request/response types from the lance_namespace_reqwest_client::models module, which are generated from the Lance Namespace REST specification.

Key method categories:

  • Namespace operations -- list_namespaces, describe_namespace, create_namespace, drop_namespace, namespace_exists
  • Table operations -- list_tables, describe_table, register_table, create_table, drop_table, rename_table, restore_table
  • Data operations -- insert_into_table, delete_from_table, update_table, merge_insert_into_table, query_table
  • Index operations -- create_table_index, drop_table_index, list_table_indices
  • Tag operations -- create_table_tag, update_table_tag, delete_table_tag, list_table_tags
  • Transaction operations -- alter_transaction, describe_transaction

Usage

Concrete implementations of this trait are provided in the lance-namespace-impls crate (e.g., REST client, local filesystem). The trait is used by higher-level catalog abstractions to manage Lance datasets across various storage backends.

Code Reference

Source Location

rust/lance-namespace/src/namespace.rs

Signature

#[async_trait]
pub trait LanceNamespace: Send + Sync + std::fmt::Debug {
    async fn list_namespaces(
        &self,
        _request: ListNamespacesRequest,
    ) -> Result<ListNamespacesResponse>;

    async fn create_namespace(
        &self,
        _request: CreateNamespaceRequest,
    ) -> Result<CreateNamespaceResponse>;

    async fn drop_namespace(
        &self,
        _request: DropNamespaceRequest,
    ) -> Result<DropNamespaceResponse>;

    async fn list_tables(
        &self,
        _request: ListTablesRequest,
    ) -> Result<ListTablesResponse>;

    async fn create_table(
        &self,
        _request: CreateTableRequest,
    ) -> Result<CreateTableResponse>;

    async fn query_table(
        &self,
        _request: QueryTableRequest,
    ) -> Result<Bytes>;

    // ... 30+ additional methods with default NotSupported implementations
}

Import

use lance_namespace::namespace::LanceNamespace;

I/O Contract

Inputs

Parameter Type Description
request Various *Request structs Operation-specific request objects from lance_namespace_reqwest_client::models

Outputs

Type Description
Result<*Response> Operation-specific response wrapped in lance_core::Result
Result<Bytes> Raw byte response for query operations (e.g., Arrow IPC)
Result<()> Success/failure indicator for existence checks

Usage Examples

use lance_namespace::namespace::LanceNamespace;
use lance_namespace_reqwest_client::models::{
    ListNamespacesRequest, CreateNamespaceRequest,
};

async fn example(ns: &dyn LanceNamespace) -> lance_core::Result<()> {
    // List child namespaces
    let response = ns.list_namespaces(ListNamespacesRequest::default()).await?;
    println!("Namespaces: {:?}", response);

    // Create a new namespace
    let create_req = CreateNamespaceRequest { /* ... */ };
    let created = ns.create_namespace(create_req).await?;
    Ok(())
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment