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