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