pub struct LanceStorageGraph { /* private fields */ }Expand description
Lance-based storage backend for ArrowSpace graph embeddings.
Stores dense and sparse matrices as Lance datasets using a columnar format
(row, col, value for sparse; col_* for dense) schema for efficient
random and columnar access.
Implementations§
Source§impl LanceStorageGraph
impl LanceStorageGraph
Sourcepub fn new(_base: String, _name: String) -> Self
pub fn new(_base: String, _name: String) -> Self
Creates a new Lance storage backend.
This is used for on-the-fly creation. For proper setup use Genefold<...>::seed.
§Arguments
_base- Base directory path for all storage files_name- Name prefix for this storage instance
Sourcepub async fn spawn(
base_path: String,
) -> Result<(Self, GeneMetadata), StorageError>
pub async fn spawn( base_path: String, ) -> Result<(Self, GeneMetadata), StorageError>
Spawn a LanceStorage from an existing seeded directory (with metadata.json)
Trait Implementations§
Source§impl Clone for LanceStorageGraph
impl Clone for LanceStorageGraph
Source§fn clone(&self) -> LanceStorageGraph
fn clone(&self) -> LanceStorageGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LanceStorageGraph
impl Debug for LanceStorageGraph
Source§impl LanceStorage for LanceStorageGraph
impl LanceStorage for LanceStorageGraph
Source§async fn write_lance_batch_async(
&self,
uri: String,
batch: RecordBatch,
) -> StorageResult<()>
async fn write_lance_batch_async( &self, uri: String, batch: RecordBatch, ) -> StorageResult<()>
Source§async fn read_lance_all_batches_async(
&self,
uri: String,
) -> StorageResult<RecordBatch>
async fn read_lance_all_batches_async( &self, uri: String, ) -> StorageResult<RecordBatch>
Source§async fn read_lance_first_batch_async(
&self,
uri: String,
) -> StorageResult<RecordBatch>
async fn read_lance_first_batch_async( &self, uri: String, ) -> StorageResult<RecordBatch>
Source§impl StorageBackend for LanceStorageGraph
impl StorageBackend for LanceStorageGraph
Source§fn basepath_to_uri(&self) -> String
fn basepath_to_uri(&self) -> String
Converts the base path for the store to a file:// URI for Lance.
Source§async fn save_dense(
&self,
key: &str,
matrix: &DenseMatrix<f64>,
md_path: &Path,
) -> StorageResult<()>
async fn save_dense( &self, key: &str, matrix: &DenseMatrix<f64>, md_path: &Path, ) -> StorageResult<()>
Save dense matrix using Lance-optimized vector format.
Each row of the matrix becomes a FixedSizeList entry for efficient vector operations. This format is optimized for vector search and enables Lance’s full-zip encoding.
§Arguments
filename- any namematrix- Dense matrix to save (N rows × F cols)md_path- Metadata file path for validation
Source§async fn load_dense(&self, key: &str) -> StorageResult<DenseMatrix<f64>>
async fn load_dense(&self, key: &str) -> StorageResult<DenseMatrix<f64>>
Source§async fn load_dense_from_file(
&self,
path: &Path,
) -> StorageResult<DenseMatrix<f64>>
async fn load_dense_from_file( &self, path: &Path, ) -> StorageResult<DenseMatrix<f64>>
Load initial data using columnar format from a file path.
Async test helper that avoids any internal blocking runtimes.
Source§async fn save_dense_to_file(
data: &DenseMatrix<f64>,
path: &Path,
) -> StorageResult<()>
async fn save_dense_to_file( data: &DenseMatrix<f64>, path: &Path, ) -> StorageResult<()>
Save dense matrix to file in columnar format (col_0, col_1, …, col_N)
Async test helper that avoids any internal blocking runtimes.
Source§async fn save_centroid_map(
&self,
map: &[usize],
md_path: &Path,
) -> StorageResult<()>
async fn save_centroid_map( &self, map: &[usize], md_path: &Path, ) -> StorageResult<()>
Save centroid_map (item-to-centroid assignments)
Source§async fn load_centroid_map(&self) -> StorageResult<Vec<usize>>
async fn load_centroid_map(&self) -> StorageResult<Vec<usize>>
Load centroid_map
Source§async fn save_subcentroid_lambdas(
&self,
lambdas: &[f64],
md_path: &Path,
) -> StorageResult<()>
async fn save_subcentroid_lambdas( &self, lambdas: &[f64], md_path: &Path, ) -> StorageResult<()>
Save subcentroid_lambdas (tau values for subcentroids)
Source§async fn load_subcentroid_lambdas(&self) -> StorageResult<Vec<f64>>
async fn load_subcentroid_lambdas(&self) -> StorageResult<Vec<f64>>
Load subcentroid_lambdas
Source§async fn save_subcentroids(
&self,
subcentroids: &DenseMatrix<f64>,
md_path: &Path,
) -> StorageResult<()>
async fn save_subcentroids( &self, subcentroids: &DenseMatrix<f64>, md_path: &Path, ) -> StorageResult<()>
Save subcentroids (dense matrix)
Source§async fn load_subcentroids(&self) -> StorageResult<Vec<Vec<f64>>>
async fn load_subcentroids(&self) -> StorageResult<Vec<Vec<f64>>>
Load subcentroids as Vec<Vec
Source§async fn save_item_norms(
&self,
item_norms: &[f64],
md_path: &Path,
) -> StorageResult<()>
async fn save_item_norms( &self, item_norms: &[f64], md_path: &Path, ) -> StorageResult<()>
Save item norms vector
Source§async fn load_item_norms(&self) -> StorageResult<Vec<f64>>
async fn load_item_norms(&self) -> StorageResult<Vec<f64>>
Load item norms vector
Source§fn metadata_path(&self) -> PathBuf
fn metadata_path(&self) -> PathBuf
Source§fn file_path(&self, key: &str) -> PathBuf
fn file_path(&self, key: &str) -> PathBuf
Source§async fn save_sparse(
&self,
key: &str,
matrix: &CsMat<f64>,
md_path: &Path,
) -> StorageResult<()>
async fn save_sparse( &self, key: &str, matrix: &CsMat<f64>, md_path: &Path, ) -> StorageResult<()>
Source§async fn load_sparse(&self, key: &str) -> StorageResult<CsMat<f64>>
async fn load_sparse(&self, key: &str) -> StorageResult<CsMat<f64>>
Source§async fn save_lambdas(
&self,
lambdas: &[f64],
md_path: &Path,
) -> StorageResult<()>
async fn save_lambdas( &self, lambdas: &[f64], md_path: &Path, ) -> StorageResult<()>
Source§async fn load_lambdas(&self) -> StorageResult<Vec<f64>>
async fn load_lambdas(&self) -> StorageResult<Vec<f64>>
Source§async fn save_vector(
&self,
key: &str,
vector: &[f64],
md_path: &Path,
) -> StorageResult<()>
async fn save_vector( &self, key: &str, vector: &[f64], md_path: &Path, ) -> StorageResult<()>
Source§async fn save_index(
&self,
key: &str,
vector: &[usize],
md_path: &Path,
) -> StorageResult<()>
async fn save_index( &self, key: &str, vector: &[usize], md_path: &Path, ) -> StorageResult<()>
async fn load_vector(&self, filename: &str) -> StorageResult<Vec<f64>>
Source§async fn load_index(&self, filename: &str) -> StorageResult<Vec<usize>>
async fn load_index(&self, filename: &str) -> StorageResult<Vec<usize>>
Source§async fn save_cluster_assignments(
&self,
assignments: &[Option<usize>],
md_path: &Path,
) -> StorageResult<()>
async fn save_cluster_assignments( &self, assignments: &[Option<usize>], md_path: &Path, ) -> StorageResult<()>
Source§async fn load_cluster_assignments(&self) -> StorageResult<Vec<Option<usize>>>
async fn load_cluster_assignments(&self) -> StorageResult<Vec<Option<usize>>>
Source§fn exists(path: &str) -> (bool, Option<PathBuf>)
fn exists(path: &str) -> (bool, Option<PathBuf>)
true and the path to the metadata file if metadata file exists and is valid,
false otherwise.
This is used to avoid overwriting existing indexes.Source§fn path_to_uri(path: &Path) -> String
fn path_to_uri(path: &Path) -> String
file:// URI for Lance.Source§fn validate_initialized(&self, md_path: &Path) -> StorageResult<()>
fn validate_initialized(&self, md_path: &Path) -> StorageResult<()>
Source§fn to_dense_record_batch(
&self,
matrix: &DenseMatrix<f64>,
) -> Result<RecordBatch, StorageError>
fn to_dense_record_batch( &self, matrix: &DenseMatrix<f64>, ) -> Result<RecordBatch, StorageError>
Source§fn from_dense_record_batch(
&self,
batch: &RecordBatch,
) -> Result<DenseMatrix<f64>, StorageError>
fn from_dense_record_batch( &self, batch: &RecordBatch, ) -> Result<DenseMatrix<f64>, StorageError>
Source§fn to_sparse_record_batch(&self, m: &CsMat<f64>) -> StorageResult<RecordBatch>
fn to_sparse_record_batch(&self, m: &CsMat<f64>) -> StorageResult<RecordBatch>
Source§fn from_sparse_record_batch(
&self,
batch: RecordBatch,
expected_rows: usize,
expected_cols: usize,
) -> StorageResult<CsMat<f64>>
fn from_sparse_record_batch( &self, batch: RecordBatch, expected_rows: usize, expected_cols: usize, ) -> StorageResult<CsMat<f64>>
Source§async fn save_metadata(&self, metadata: &GeneMetadata) -> StorageResult<PathBuf>
async fn save_metadata(&self, metadata: &GeneMetadata) -> StorageResult<PathBuf>
Source§async fn load_metadata(&self) -> StorageResult<GeneMetadata>
async fn load_metadata(&self) -> StorageResult<GeneMetadata>
Auto Trait Implementations§
impl Freeze for LanceStorageGraph
impl RefUnwindSafe for LanceStorageGraph
impl Send for LanceStorageGraph
impl Sync for LanceStorageGraph
impl Unpin for LanceStorageGraph
impl UnsafeUnpin for LanceStorageGraph
impl UnwindSafe for LanceStorageGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.