1use arrow_buffer::ToByteSlice;
5use snafu::location;
6use uuid::Uuid;
7
8mod fragment;
9mod index;
10mod manifest;
11mod transaction;
12
13pub use crate::rowids::version::{
14 RowDatasetVersionMeta, RowDatasetVersionRun, RowDatasetVersionSequence,
15};
16pub use fragment::*;
17pub use index::IndexMetadata;
18
19pub use manifest::{
20 is_detached_version, BasePath, DataStorageFormat, Manifest, SelfDescribingFileReader,
21 WriterVersion, DETACHED_VERSION_MASK,
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::io(
56 "Protobuf UUID is malformed".to_string(),
57 location!(),
58 ));
59 }
60 let mut buf: [u8; 16] = [0; 16];
61 buf.copy_from_slice(p.uuid.to_byte_slice());
62 Ok(Self::from_bytes(buf))
63 }
64}
65
66impl From<&Uuid> for pb::Uuid {
67 fn from(value: &Uuid) -> Self {
68 Self {
69 uuid: value.into_bytes().to_vec(),
70 }
71 }
72}