| 1 | // Copyright 2024 Lance Developers. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | use std::collections::HashMap; |
| 16 | |
| 17 | use napi_derive::*; |
| 18 | |
| 19 | mod connection; |
| 20 | mod error; |
| 21 | mod index; |
| 22 | mod iterator; |
| 23 | pub mod merge; |
| 24 | mod query; |
| 25 | mod table; |
| 26 | mod util; |
| 27 | |
| 28 | #[napi(object)] |
| 29 | #[derive(Debug)] |
| 30 | pub struct ConnectionOptions { |
| 31 | /// (For LanceDB OSS only): The interval, in seconds, at which to check for |
| 32 | /// updates to the table from other processes. If None, then consistency is not |
| 33 | /// checked. For performance reasons, this is the default. For strong |
| 34 | /// consistency, set this to zero seconds. Then every read will check for |
| 35 | /// updates from other processes. As a compromise, you can set this to a |
| 36 | /// non-zero value for eventual consistency. If more than that interval |
| 37 | /// has passed since the last check, then the table will be checked for updates. |
| 38 | /// Note: this consistency only applies to read operations. Write operations are |
| 39 | /// always consistent. |
| 40 | pub read_consistency_interval: Option<f64>, |
| 41 | /// (For LanceDB OSS only): configuration for object storage. |
| 42 | /// |
| 43 | /// The available options are described at https://lancedb.github.io/lancedb/guides/storage/ |
| 44 | pub storage_options: Option<HashMap<String, String>>, |
| 45 | } |
| 46 | |
| 47 | /// Write mode for writing a table. |
| 48 | #[napi(string_enum)] |
| 49 | pub enum WriteMode { |
| 50 | Create, |
| 51 | Append, |
| 52 | Overwrite, |
| 53 | } |
| 54 | |
| 55 | /// Write options when creating a Table. |
| 56 | #[napi(object)] |
| 57 | pub struct WriteOptions { |
| 58 | /// Write mode for writing to a table. |
| 59 | pub mode: Option<WriteMode>, |
| 60 | } |
| 61 | |
| 62 | #[napi(object)] |
| 63 | pub struct OpenTableOptions { |
| 64 | pub storage_options: Option<HashMap<String, String>>, |
| 65 | } |