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