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(
352 &self,
353 _request: BatchDeleteTableVersionsRequest,
354 ) -> Result<BatchDeleteTableVersionsResponse> {
355 Err(Error::not_supported(
356 "batch_delete_table_versions not implemented",
357 ))
358 }
359
360 async fn update_table_schema_metadata(
362 &self,
363 _request: UpdateTableSchemaMetadataRequest,
364 ) -> Result<UpdateTableSchemaMetadataResponse> {
365 Err(Error::not_supported(
366 "update_table_schema_metadata not implemented",
367 ))
368 }
369
370 async fn get_table_stats(
372 &self,
373 _request: GetTableStatsRequest,
374 ) -> Result<GetTableStatsResponse> {
375 Err(Error::not_supported("get_table_stats not implemented"))
376 }
377
378 async fn explain_table_query_plan(
380 &self,
381 _request: ExplainTableQueryPlanRequest,
382 ) -> Result<String> {
383 Err(Error::not_supported(
384 "explain_table_query_plan not implemented",
385 ))
386 }
387
388 async fn analyze_table_query_plan(
390 &self,
391 _request: AnalyzeTableQueryPlanRequest,
392 ) -> Result<String> {
393 Err(Error::not_supported(
394 "analyze_table_query_plan not implemented",
395 ))
396 }
397
398 async fn alter_table_add_columns(
400 &self,
401 _request: AlterTableAddColumnsRequest,
402 ) -> Result<AlterTableAddColumnsResponse> {
403 Err(Error::not_supported(
404 "alter_table_add_columns not implemented",
405 ))
406 }
407
408 async fn alter_table_alter_columns(
410 &self,
411 _request: AlterTableAlterColumnsRequest,
412 ) -> Result<AlterTableAlterColumnsResponse> {
413 Err(Error::not_supported(
414 "alter_table_alter_columns not implemented",
415 ))
416 }
417
418 async fn alter_table_drop_columns(
420 &self,
421 _request: AlterTableDropColumnsRequest,
422 ) -> Result<AlterTableDropColumnsResponse> {
423 Err(Error::not_supported(
424 "alter_table_drop_columns not implemented",
425 ))
426 }
427
428 async fn list_table_tags(
430 &self,
431 _request: ListTableTagsRequest,
432 ) -> Result<ListTableTagsResponse> {
433 Err(Error::not_supported("list_table_tags not implemented"))
434 }
435
436 async fn get_table_tag_version(
438 &self,
439 _request: GetTableTagVersionRequest,
440 ) -> Result<GetTableTagVersionResponse> {
441 Err(Error::not_supported(
442 "get_table_tag_version not implemented",
443 ))
444 }
445
446 async fn create_table_tag(
448 &self,
449 _request: CreateTableTagRequest,
450 ) -> Result<CreateTableTagResponse> {
451 Err(Error::not_supported("create_table_tag not implemented"))
452 }
453
454 async fn delete_table_tag(
456 &self,
457 _request: DeleteTableTagRequest,
458 ) -> Result<DeleteTableTagResponse> {
459 Err(Error::not_supported("delete_table_tag not implemented"))
460 }
461
462 async fn update_table_tag(
464 &self,
465 _request: UpdateTableTagRequest,
466 ) -> Result<UpdateTableTagResponse> {
467 Err(Error::not_supported("update_table_tag not implemented"))
468 }
469
470 fn namespace_id(&self) -> String;
484}