1use arrow_buffer::ToByteSlice;
5use uuid::Uuid;
6
7mod fragment;
8mod index;
9mod manifest;
10pub mod overlay;
11mod transaction;
12
13pub use crate::rowids::version::{
14 RowDatasetVersionMeta, RowDatasetVersionRun, RowDatasetVersionSequence,
15};
16pub use fragment::*;
17pub use index::{IndexFile, IndexMetadata, index_metadata_codec, list_index_files_with_sizes};
18
19pub use manifest::{
20 BasePath, DETACHED_VERSION_MASK, DataStorageFormat, Manifest, SelfDescribingFileReader,
21 WriterVersion, is_detached_version,
22};
23pub use transaction::Transaction;
24
25use lance_core::{Error, Result};
26
27#[deprecated(since = "0.36.1", note = "Use IndexMetadata instead")]
30pub type Index = IndexMetadata;
31
32pub mod pb {
34 #![allow(clippy::all)]
35 #![allow(non_upper_case_globals)]
36 #![allow(non_camel_case_types)]
37 #![allow(non_snake_case)]
38 #![allow(unused)]
39 #![allow(improper_ctypes)]
40 #![allow(clippy::upper_case_acronyms)]
41 #![allow(clippy::use_self)]
42 include!(concat!(env!("OUT_DIR"), "/lance.table.rs"));
43}
44
45pub const MAJOR_VERSION: i16 = 0;
47pub const MINOR_VERSION: i16 = 1;
48pub const MAGIC: &[u8; 4] = b"LANC";
49
50impl TryFrom<&pb::Uuid> for Uuid {
51 type Error = Error;
52
53 fn try_from(p: &pb::Uuid) -> Result<Self> {
54 if p.uuid.len() != 16 {
55 return Err(Error::invalid_input(
56 "Protobuf UUID is malformed".to_string(),
57 ));
58 }
59 let mut buf: [u8; 16] = [0; 16];
60 buf.copy_from_slice(p.uuid.to_byte_slice());
61 Ok(Self::from_bytes(buf))
62 }
63}
64
65impl From<&Uuid> for pb::Uuid {
66 fn from(value: &Uuid) -> Self {
67 Self {
68 uuid: value.into_bytes().to_vec(),
69 }
70 }
71}