1use async_trait::async_trait;
7use bytes::Bytes;
8use lance_core::{Error, Result};
9
10use lance_namespace_reqwest_client::models::{
11 AlterTableAddColumnsRequest, AlterTableAddColumnsResponse, AlterTableAlterColumnsRequest,
12 AlterTableAlterColumnsResponse, AlterTableDropColumnsRequest, AlterTableDropColumnsResponse,
13 AlterTransactionRequest, AlterTransactionResponse, AnalyzeTableQueryPlanRequest,
14 BatchDeleteTableVersionsRequest, BatchDeleteTableVersionsResponse, CountTableRowsRequest,
15 CreateNamespaceRequest, CreateNamespaceResponse, CreateTableIndexRequest,
16 CreateTableIndexResponse, CreateTableRequest, CreateTableResponse,
17 CreateTableScalarIndexResponse, CreateTableTagRequest, CreateTableTagResponse,
18 CreateTableVersionRequest, CreateTableVersionResponse, DeclareTableRequest,
19 DeclareTableResponse, DeleteFromTableRequest, DeleteFromTableResponse, DeleteTableTagRequest,
20 DeleteTableTagResponse, DeregisterTableRequest, DeregisterTableResponse,
21 DescribeNamespaceRequest, DescribeNamespaceResponse, DescribeTableIndexStatsRequest,
22 DescribeTableIndexStatsResponse, DescribeTableRequest, DescribeTableResponse,
23 DescribeTableVersionRequest, DescribeTableVersionResponse, DescribeTransactionRequest,
24 DescribeTransactionResponse, DropNamespaceRequest, DropNamespaceResponse,
25 DropTableIndexRequest, DropTableIndexResponse, DropTableRequest, DropTableResponse,
26 ExplainTableQueryPlanRequest, GetTableStatsRequest, GetTableStatsResponse,
27 GetTableTagVersionRequest, GetTableTagVersionResponse, InsertIntoTableRequest,
28 InsertIntoTableResponse, ListNamespacesRequest, ListNamespacesResponse,
29 ListTableIndicesRequest, ListTableIndicesResponse, ListTableTagsRequest, ListTableTagsResponse,
30 ListTableVersionsRequest, ListTableVersionsResponse, ListTablesRequest, ListTablesResponse,
31 MergeInsertIntoTableRequest, MergeInsertIntoTableResponse, NamespaceExistsRequest,
32 QueryTableRequest, RegisterTableRequest, RegisterTableResponse, RenameTableRequest,
33 RenameTableResponse, RestoreTableRequest, RestoreTableResponse, TableExistsRequest,
34 UpdateTableRequest, UpdateTableResponse, UpdateTableSchemaMetadataRequest,
35 UpdateTableSchemaMetadataResponse, UpdateTableTagRequest, UpdateTableTagResponse,
36};
37
38#[async_trait]
57pub trait LanceNamespace: Send + Sync + std::fmt::Debug {
58 async fn list_namespaces(
64 &self,
65 _request: ListNamespacesRequest,
66 ) -> Result<ListNamespacesResponse> {
67 Err(Error::not_supported("list_namespaces not implemented"))
68 }
69
70 async fn describe_namespace(
76 &self,
77 _request: DescribeNamespaceRequest,
78 ) -> Result<DescribeNamespaceResponse> {
79 Err(Error::not_supported("describe_namespace not implemented"))
80 }
81
82 async fn create_namespace(
88 &self,
89 _request: CreateNamespaceRequest,
90 ) -> Result<CreateNamespaceResponse> {
91 Err(Error::not_supported("create_namespace not implemented"))
92 }
93
94 async fn drop_namespace(
101 &self,
102 _request: DropNamespaceRequest,
103 ) -> Result<DropNamespaceResponse> {
104 Err(Error::not_supported("drop_namespace not implemented"))
105 }
106
107 async fn namespace_exists(&self, _request: NamespaceExistsRequest) -> Result<()> {
113 Err(Error::not_supported("namespace_exists not implemented"))
114 }
115
116 async fn list_tables(&self, _request: ListTablesRequest) -> Result<ListTablesResponse> {
118 Err(Error::not_supported("list_tables not implemented"))
119 }
120
121 async fn describe_table(
123 &self,
124 _request: DescribeTableRequest,
125 ) -> Result<DescribeTableResponse> {
126 Err(Error::not_supported("describe_table not implemented"))
127 }
128
129 async fn register_table(
131 &self,
132 _request: RegisterTableRequest,
133 ) -> Result<RegisterTableResponse> {
134 Err(Error::not_supported("register_table not implemented"))
135 }
136
137 async fn table_exists(&self, _request: TableExistsRequest) -> Result<()> {
139 Err(Error::not_supported("table_exists not implemented"))
140 }
141
142 async fn drop_table(&self, _request: DropTableRequest) -> Result<DropTableResponse> {
144 Err(Error::not_supported("drop_table not implemented"))
145 }
146
147 async fn deregister_table(
149 &self,
150 _request: DeregisterTableRequest,
151 ) -> Result<DeregisterTableResponse> {
152 Err(Error::not_supported("deregister_table not implemented"))
153 }
154
155 async fn count_table_rows(&self, _request: CountTableRowsRequest) -> Result<i64> {
157 Err(Error::not_supported("count_table_rows not implemented"))
158 }
159
160 async fn create_table(
162 &self,
163 _request: CreateTableRequest,
164 _request_data: Bytes,
165 ) -> Result<CreateTableResponse> {
166 Err(Error::not_supported("create_table not implemented"))
167 }
168
169 async fn declare_table(&self, _request: DeclareTableRequest) -> Result<DeclareTableResponse> {
171 Err(Error::not_supported("declare_table not implemented"))
172 }
173
174 async fn insert_into_table(
176 &self,
177 _request: InsertIntoTableRequest,
178 _request_data: Bytes,
179 ) -> Result<InsertIntoTableResponse> {
180 Err(Error::not_supported("insert_into_table not implemented"))
181 }
182
183 async fn merge_insert_into_table(
185 &self,
186 _request: MergeInsertIntoTableRequest,
187 _request_data: Bytes,
188 ) -> Result<MergeInsertIntoTableResponse> {
189 Err(Error::not_supported(
190 "merge_insert_into_table not implemented",
191 ))
192 }
193
194 async fn update_table(&self, _request: UpdateTableRequest) -> Result<UpdateTableResponse> {
196 Err(Error::not_supported("update_table not implemented"))
197 }
198
199 async fn delete_from_table(
201 &self,
202 _request: DeleteFromTableRequest,
203 ) -> Result<DeleteFromTableResponse> {
204 Err(Error::not_supported("delete_from_table not implemented"))
205 }
206
207 async fn query_table(&self, _request: QueryTableRequest) -> Result<Bytes> {
209 Err(Error::not_supported("query_table not implemented"))
210 }
211
212 async fn create_table_index(
214 &self,
215 _request: CreateTableIndexRequest,
216 ) -> Result<CreateTableIndexResponse> {
217 Err(Error::not_supported("create_table_index not implemented"))
218 }
219
220 async fn list_table_indices(
222 &self,
223 _request: ListTableIndicesRequest,
224 ) -> Result<ListTableIndicesResponse> {
225 Err(Error::not_supported("list_table_indices not implemented"))
226 }
227
228 async fn describe_table_index_stats(
230 &self,
231 _request: DescribeTableIndexStatsRequest,
232 ) -> Result<DescribeTableIndexStatsResponse> {
233 Err(Error::not_supported(
234 "describe_table_index_stats not implemented",
235 ))
236 }
237
238 async fn describe_transaction(
240 &self,
241 _request: DescribeTransactionRequest,
242 ) -> Result<DescribeTransactionResponse> {
243 Err(Error::not_supported("describe_transaction not implemented"))
244 }
245
246 async fn alter_transaction(
248 &self,
249 _request: AlterTransactionRequest,
250 ) -> Result<AlterTransactionResponse> {
251 Err(Error::not_supported("alter_transaction not implemented"))
252 }
253
254 async fn create_table_scalar_index(
256 &self,
257 _request: CreateTableIndexRequest,
258 ) -> Result<CreateTableScalarIndexResponse> {
259 Err(Error::not_supported(
260 "create_table_scalar_index not implemented",
261 ))
262 }
263
264 async fn drop_table_index(
266 &self,
267 _request: DropTableIndexRequest,
268 ) -> Result<DropTableIndexResponse> {
269 Err(Error::not_supported("drop_table_index not implemented"))
270 }
271
272 async fn list_all_tables(&self, _request: ListTablesRequest) -> Result<ListTablesResponse> {
274 Err(Error::not_supported("list_all_tables not implemented"))
275 }
276
277 async fn restore_table(&self, _request: RestoreTableRequest) -> Result<RestoreTableResponse> {
279 Err(Error::not_supported("restore_table not implemented"))
280 }
281
282 async fn rename_table(&self, _request: RenameTableRequest) -> Result<RenameTableResponse> {
284 Err(Error::not_supported("rename_table not implemented"))
285 }
286
287 async fn list_table_versions(
289 &self,
290 _request: ListTableVersionsRequest,
291 ) -> Result<ListTableVersionsResponse> {
292 Err(Error::not_supported("list_table_versions not implemented"))
293 }
294
295 async fn create_table_version(
311 &self,
312 _request: CreateTableVersionRequest,
313 ) -> Result<CreateTableVersionResponse> {
314 Err(Error::not_supported("create_table_version not implemented"))
315 }
316
317 async fn describe_table_version(
332 &self,
333 _request: DescribeTableVersionRequest,
334 ) -> Result<DescribeTableVersionResponse> {
335 Err(Error::not_supported(
336 "describe_table_version not implemented",
337 ))
338 }
339
340 async fn batch_delete_table_versions(
353 &self,
354 _request: BatchDeleteTableVersionsRequest,
355 ) -> Result<BatchDeleteTableVersionsResponse> {
356 Err(Error::not_supported(
357 "batch_delete_table_versions not implemented",
358 ))
359 }
360
361 async fn update_table_schema_metadata(
363 &self,
364 _request: UpdateTableSchemaMetadataRequest,
365 ) -> Result<UpdateTableSchemaMetadataResponse> {
366 Err(Error::not_supported(
367 "update_table_schema_metadata not implemented",
368 ))
369 }
370
371 async fn get_table_stats(
373 &self,
374 _request: GetTableStatsRequest,
375 ) -> Result<GetTableStatsResponse> {
376 Err(Error::not_supported("get_table_stats not implemented"))
377 }
378
379 async fn explain_table_query_plan(
381 &self,
382 _request: ExplainTableQueryPlanRequest,
383 ) -> Result<String> {
384 Err(Error::not_supported(
385 "explain_table_query_plan not implemented",
386 ))
387 }
388
389 async fn analyze_table_query_plan(
391 &self,
392 _request: AnalyzeTableQueryPlanRequest,
393 ) -> Result<String> {
394 Err(Error::not_supported(
395 "analyze_table_query_plan not implemented",
396 ))
397 }
398
399 async fn alter_table_add_columns(
401 &self,
402 _request: AlterTableAddColumnsRequest,
403 ) -> Result<AlterTableAddColumnsResponse> {
404 Err(Error::not_supported(
405 "alter_table_add_columns not implemented",
406 ))
407 }
408
409 async fn alter_table_alter_columns(
411 &self,
412 _request: AlterTableAlterColumnsRequest,
413 ) -> Result<AlterTableAlterColumnsResponse> {
414 Err(Error::not_supported(
415 "alter_table_alter_columns not implemented",
416 ))
417 }
418
419 async fn alter_table_drop_columns(
421 &self,
422 _request: AlterTableDropColumnsRequest,
423 ) -> Result<AlterTableDropColumnsResponse> {
424 Err(Error::not_supported(
425 "alter_table_drop_columns not implemented",
426 ))
427 }
428
429 async fn list_table_tags(
431 &self,
432 _request: ListTableTagsRequest,
433 ) -> Result<ListTableTagsResponse> {
434 Err(Error::not_supported("list_table_tags not implemented"))
435 }
436
437 async fn get_table_tag_version(
439 &self,
440 _request: GetTableTagVersionRequest,
441 ) -> Result<GetTableTagVersionResponse> {
442 Err(Error::not_supported(
443 "get_table_tag_version not implemented",
444 ))
445 }
446
447 async fn create_table_tag(
449 &self,
450 _request: CreateTableTagRequest,
451 ) -> Result<CreateTableTagResponse> {
452 Err(Error::not_supported("create_table_tag not implemented"))
453 }
454
455 async fn delete_table_tag(
457 &self,
458 _request: DeleteTableTagRequest,
459 ) -> Result<DeleteTableTagResponse> {
460 Err(Error::not_supported("delete_table_tag not implemented"))
461 }
462
463 async fn update_table_tag(
465 &self,
466 _request: UpdateTableTagRequest,
467 ) -> Result<UpdateTableTagResponse> {
468 Err(Error::not_supported("update_table_tag not implemented"))
469 }
470
471 fn namespace_id(&self) -> String;
485}