use async_trait::async_trait;
use bytes::Bytes;
use lance_core::{Error, Result};
use lance_namespace_reqwest_client::models::{
AlterTableAddColumnsRequest, AlterTableAddColumnsResponse, AlterTableAlterColumnsRequest,
AlterTableAlterColumnsResponse, AlterTableDropColumnsRequest, AlterTableDropColumnsResponse,
AlterTransactionRequest, AlterTransactionResponse, AnalyzeTableQueryPlanRequest,
BatchDeleteTableVersionsRequest, BatchDeleteTableVersionsResponse, CountTableRowsRequest,
CreateNamespaceRequest, CreateNamespaceResponse, CreateTableIndexRequest,
CreateTableIndexResponse, CreateTableRequest, CreateTableResponse,
CreateTableScalarIndexResponse, CreateTableTagRequest, CreateTableTagResponse,
CreateTableVersionRequest, CreateTableVersionResponse, DeclareTableRequest,
DeclareTableResponse, DeleteFromTableRequest, DeleteFromTableResponse, DeleteTableTagRequest,
DeleteTableTagResponse, DeregisterTableRequest, DeregisterTableResponse,
DescribeNamespaceRequest, DescribeNamespaceResponse, DescribeTableIndexStatsRequest,
DescribeTableIndexStatsResponse, DescribeTableRequest, DescribeTableResponse,
DescribeTableVersionRequest, DescribeTableVersionResponse, DescribeTransactionRequest,
DescribeTransactionResponse, DropNamespaceRequest, DropNamespaceResponse,
DropTableIndexRequest, DropTableIndexResponse, DropTableRequest, DropTableResponse,
ExplainTableQueryPlanRequest, GetTableStatsRequest, GetTableStatsResponse,
GetTableTagVersionRequest, GetTableTagVersionResponse, InsertIntoTableRequest,
InsertIntoTableResponse, ListNamespacesRequest, ListNamespacesResponse,
ListTableIndicesRequest, ListTableIndicesResponse, ListTableTagsRequest, ListTableTagsResponse,
ListTableVersionsRequest, ListTableVersionsResponse, ListTablesRequest, ListTablesResponse,
MergeInsertIntoTableRequest, MergeInsertIntoTableResponse, NamespaceExistsRequest,
QueryTableRequest, RegisterTableRequest, RegisterTableResponse, RenameTableRequest,
RenameTableResponse, RestoreTableRequest, RestoreTableResponse, TableExistsRequest,
UpdateTableRequest, UpdateTableResponse, UpdateTableSchemaMetadataRequest,
UpdateTableSchemaMetadataResponse, UpdateTableTagRequest, UpdateTableTagResponse,
};
#[async_trait]
pub trait LanceNamespace: Send + Sync + std::fmt::Debug {
async fn list_namespaces(
&self,
_request: ListNamespacesRequest,
) -> Result<ListNamespacesResponse> {
Err(Error::not_supported("list_namespaces not implemented"))
}
async fn describe_namespace(
&self,
_request: DescribeNamespaceRequest,
) -> Result<DescribeNamespaceResponse> {
Err(Error::not_supported("describe_namespace not implemented"))
}
async fn create_namespace(
&self,
_request: CreateNamespaceRequest,
) -> Result<CreateNamespaceResponse> {
Err(Error::not_supported("create_namespace not implemented"))
}
async fn drop_namespace(
&self,
_request: DropNamespaceRequest,
) -> Result<DropNamespaceResponse> {
Err(Error::not_supported("drop_namespace not implemented"))
}
async fn namespace_exists(&self, _request: NamespaceExistsRequest) -> Result<()> {
Err(Error::not_supported("namespace_exists not implemented"))
}
async fn list_tables(&self, _request: ListTablesRequest) -> Result<ListTablesResponse> {
Err(Error::not_supported("list_tables not implemented"))
}
async fn describe_table(
&self,
_request: DescribeTableRequest,
) -> Result<DescribeTableResponse> {
Err(Error::not_supported("describe_table not implemented"))
}
async fn register_table(
&self,
_request: RegisterTableRequest,
) -> Result<RegisterTableResponse> {
Err(Error::not_supported("register_table not implemented"))
}
async fn table_exists(&self, _request: TableExistsRequest) -> Result<()> {
Err(Error::not_supported("table_exists not implemented"))
}
async fn drop_table(&self, _request: DropTableRequest) -> Result<DropTableResponse> {
Err(Error::not_supported("drop_table not implemented"))
}
async fn deregister_table(
&self,
_request: DeregisterTableRequest,
) -> Result<DeregisterTableResponse> {
Err(Error::not_supported("deregister_table not implemented"))
}
async fn count_table_rows(&self, _request: CountTableRowsRequest) -> Result<i64> {
Err(Error::not_supported("count_table_rows not implemented"))
}
async fn create_table(
&self,
_request: CreateTableRequest,
_request_data: Bytes,
) -> Result<CreateTableResponse> {
Err(Error::not_supported("create_table not implemented"))
}
async fn declare_table(&self, _request: DeclareTableRequest) -> Result<DeclareTableResponse> {
Err(Error::not_supported("declare_table not implemented"))
}
async fn insert_into_table(
&self,
_request: InsertIntoTableRequest,
_request_data: Bytes,
) -> Result<InsertIntoTableResponse> {
Err(Error::not_supported("insert_into_table not implemented"))
}
async fn merge_insert_into_table(
&self,
_request: MergeInsertIntoTableRequest,
_request_data: Bytes,
) -> Result<MergeInsertIntoTableResponse> {
Err(Error::not_supported(
"merge_insert_into_table not implemented",
))
}
async fn update_table(&self, _request: UpdateTableRequest) -> Result<UpdateTableResponse> {
Err(Error::not_supported("update_table not implemented"))
}
async fn delete_from_table(
&self,
_request: DeleteFromTableRequest,
) -> Result<DeleteFromTableResponse> {
Err(Error::not_supported("delete_from_table not implemented"))
}
async fn query_table(&self, _request: QueryTableRequest) -> Result<Bytes> {
Err(Error::not_supported("query_table not implemented"))
}
async fn create_table_index(
&self,
_request: CreateTableIndexRequest,
) -> Result<CreateTableIndexResponse> {
Err(Error::not_supported("create_table_index not implemented"))
}
async fn list_table_indices(
&self,
_request: ListTableIndicesRequest,
) -> Result<ListTableIndicesResponse> {
Err(Error::not_supported("list_table_indices not implemented"))
}
async fn describe_table_index_stats(
&self,
_request: DescribeTableIndexStatsRequest,
) -> Result<DescribeTableIndexStatsResponse> {
Err(Error::not_supported(
"describe_table_index_stats not implemented",
))
}
async fn describe_transaction(
&self,
_request: DescribeTransactionRequest,
) -> Result<DescribeTransactionResponse> {
Err(Error::not_supported("describe_transaction not implemented"))
}
async fn alter_transaction(
&self,
_request: AlterTransactionRequest,
) -> Result<AlterTransactionResponse> {
Err(Error::not_supported("alter_transaction not implemented"))
}
async fn create_table_scalar_index(
&self,
_request: CreateTableIndexRequest,
) -> Result<CreateTableScalarIndexResponse> {
Err(Error::not_supported(
"create_table_scalar_index not implemented",
))
}
async fn drop_table_index(
&self,
_request: DropTableIndexRequest,
) -> Result<DropTableIndexResponse> {
Err(Error::not_supported("drop_table_index not implemented"))
}
async fn list_all_tables(&self, _request: ListTablesRequest) -> Result<ListTablesResponse> {
Err(Error::not_supported("list_all_tables not implemented"))
}
async fn restore_table(&self, _request: RestoreTableRequest) -> Result<RestoreTableResponse> {
Err(Error::not_supported("restore_table not implemented"))
}
async fn rename_table(&self, _request: RenameTableRequest) -> Result<RenameTableResponse> {
Err(Error::not_supported("rename_table not implemented"))
}
async fn list_table_versions(
&self,
_request: ListTableVersionsRequest,
) -> Result<ListTableVersionsResponse> {
Err(Error::not_supported("list_table_versions not implemented"))
}
async fn create_table_version(
&self,
_request: CreateTableVersionRequest,
) -> Result<CreateTableVersionResponse> {
Err(Error::not_supported("create_table_version not implemented"))
}
async fn describe_table_version(
&self,
_request: DescribeTableVersionRequest,
) -> Result<DescribeTableVersionResponse> {
Err(Error::not_supported(
"describe_table_version not implemented",
))
}
async fn batch_delete_table_versions(
&self,
_request: BatchDeleteTableVersionsRequest,
) -> Result<BatchDeleteTableVersionsResponse> {
Err(Error::not_supported(
"batch_delete_table_versions not implemented",
))
}
async fn update_table_schema_metadata(
&self,
_request: UpdateTableSchemaMetadataRequest,
) -> Result<UpdateTableSchemaMetadataResponse> {
Err(Error::not_supported(
"update_table_schema_metadata not implemented",
))
}
async fn get_table_stats(
&self,
_request: GetTableStatsRequest,
) -> Result<GetTableStatsResponse> {
Err(Error::not_supported("get_table_stats not implemented"))
}
async fn explain_table_query_plan(
&self,
_request: ExplainTableQueryPlanRequest,
) -> Result<String> {
Err(Error::not_supported(
"explain_table_query_plan not implemented",
))
}
async fn analyze_table_query_plan(
&self,
_request: AnalyzeTableQueryPlanRequest,
) -> Result<String> {
Err(Error::not_supported(
"analyze_table_query_plan not implemented",
))
}
async fn alter_table_add_columns(
&self,
_request: AlterTableAddColumnsRequest,
) -> Result<AlterTableAddColumnsResponse> {
Err(Error::not_supported(
"alter_table_add_columns not implemented",
))
}
async fn alter_table_alter_columns(
&self,
_request: AlterTableAlterColumnsRequest,
) -> Result<AlterTableAlterColumnsResponse> {
Err(Error::not_supported(
"alter_table_alter_columns not implemented",
))
}
async fn alter_table_drop_columns(
&self,
_request: AlterTableDropColumnsRequest,
) -> Result<AlterTableDropColumnsResponse> {
Err(Error::not_supported(
"alter_table_drop_columns not implemented",
))
}
async fn list_table_tags(
&self,
_request: ListTableTagsRequest,
) -> Result<ListTableTagsResponse> {
Err(Error::not_supported("list_table_tags not implemented"))
}
async fn get_table_tag_version(
&self,
_request: GetTableTagVersionRequest,
) -> Result<GetTableTagVersionResponse> {
Err(Error::not_supported(
"get_table_tag_version not implemented",
))
}
async fn create_table_tag(
&self,
_request: CreateTableTagRequest,
) -> Result<CreateTableTagResponse> {
Err(Error::not_supported("create_table_tag not implemented"))
}
async fn delete_table_tag(
&self,
_request: DeleteTableTagRequest,
) -> Result<DeleteTableTagResponse> {
Err(Error::not_supported("delete_table_tag not implemented"))
}
async fn update_table_tag(
&self,
_request: UpdateTableTagRequest,
) -> Result<UpdateTableTagResponse> {
Err(Error::not_supported("update_table_tag not implemented"))
}
fn namespace_id(&self) -> String;
}