pub struct StorageManager { /* private fields */ }Implementations§
Source§impl StorageManager
impl StorageManager
pub async fn new(db_path: &str) -> Result<Self>
Sourcepub async fn new_lance_only(db_path: &str) -> Result<Self>
pub async fn new_lance_only(db_path: &str) -> Result<Self>
Create a storage manager for CLI tools. Use this for CLI tools that only need vector operations (index/search).
pub fn lance_path(&self) -> &str
pub async fn require_current_schema_for_writes(&self) -> Result<()>
pub async fn schema_status( &self, expected_schema: SchemaVersion, ) -> Result<SchemaStatusReport>
pub async fn missing_required_columns( table: &Table, target: SchemaVersion, ) -> Result<Vec<Field>>
pub async fn migrate_lance_schema( db_path: &str, target: SchemaVersion, check_only: bool, ) -> Result<SchemaMigrationReport>
pub fn cross_store_recovery_dir(&self) -> PathBuf
pub fn persist_cross_store_recovery_batch( &self, batch: &CrossStoreRecoveryBatch, ) -> Result<PathBuf>
pub fn update_cross_store_recovery_batch( &self, batch: &CrossStoreRecoveryBatch, ) -> Result<PathBuf>
pub fn clear_cross_store_recovery_batch(&self, batch_id: &str) -> Result<()>
pub fn list_cross_store_recovery_batches( &self, ) -> Result<Vec<CrossStoreRecoveryBatch>>
Sourcepub async fn refresh(&self) -> Result<()>
pub async fn refresh(&self) -> Result<()>
Refresh the table connection to see new data written by other processes. This clears the cached table reference, forcing it to be re-opened on next query.
pub async fn ensure_collection(&self) -> Result<()>
pub async fn add_to_store(&self, documents: Vec<ChromaDocument>) -> Result<()>
pub async fn search_store( &self, namespace: Option<&str>, embedding: Vec<f32>, k: usize, ) -> Result<Vec<ChromaDocument>>
Sourcepub async fn all_documents_page(
&self,
namespace: Option<&str>,
offset: usize,
limit: usize,
) -> Result<Vec<ChromaDocument>>
pub async fn all_documents_page( &self, namespace: Option<&str>, offset: usize, limit: usize, ) -> Result<Vec<ChromaDocument>>
Return a single page of documents without running a vector search.
Used by admin/reporting paths that need deterministic limit/offset behavior without assuming any embedding dimension or creating a table on read.
Sourcepub async fn all_documents(
&self,
namespace: Option<&str>,
limit: usize,
) -> Result<Vec<ChromaDocument>>
pub async fn all_documents( &self, namespace: Option<&str>, limit: usize, ) -> Result<Vec<ChromaDocument>>
Return documents without running a vector search. Used by admin/reporting paths that need a bounded full-table scan starting from the first row.
pub async fn get_document( &self, namespace: &str, id: &str, ) -> Result<Option<ChromaDocument>>
pub async fn delete_document(&self, namespace: &str, id: &str) -> Result<usize>
Sourcepub async fn delete_documents(
&self,
namespace: &str,
ids: &[&str],
) -> Result<usize>
pub async fn delete_documents( &self, namespace: &str, ids: &[&str], ) -> Result<usize>
Batch delete documents by IDs within a namespace.
Issues a single DELETE WHERE namespace = X AND id IN (...) per chunk,
avoiding the per-document table scan that delete_document incurs when
called in a loop. Predicate is split into 500-id chunks to keep SQL
length bounded regardless of caller batch size.
pub async fn delete_namespace_documents(&self, namespace: &str) -> Result<usize>
pub async fn rename_namespace_atomic( &self, from: &str, to: &str, ) -> Result<usize>
pub fn get_collection_name(&self) -> &str
pub async fn get_filtered_in_namespace( &self, namespace: &str, filter: &str, ) -> Result<Vec<ChromaDocument>>
Sourcepub async fn search_store_with_layer(
&self,
namespace: Option<&str>,
embedding: Vec<f32>,
k: usize,
layer_filter: Option<SliceLayer>,
) -> Result<Vec<ChromaDocument>>
pub async fn search_store_with_layer( &self, namespace: Option<&str>, embedding: Vec<f32>, k: usize, layer_filter: Option<SliceLayer>, ) -> Result<Vec<ChromaDocument>>
Search with optional layer filtering for onion slice architecture
Sourcepub async fn get_children(
&self,
namespace: &str,
parent_id: &str,
) -> Result<Vec<ChromaDocument>>
pub async fn get_children( &self, namespace: &str, parent_id: &str, ) -> Result<Vec<ChromaDocument>>
Get a document by ID and expand to get its children
Sourcepub async fn get_parent(
&self,
namespace: &str,
child_id: &str,
) -> Result<Option<ChromaDocument>>
pub async fn get_parent( &self, namespace: &str, child_id: &str, ) -> Result<Option<ChromaDocument>>
Get the parent of a document (drill up in onion hierarchy)
Sourcepub async fn has_content_hash(
&self,
namespace: &str,
hash: &str,
) -> Result<bool>
pub async fn has_content_hash( &self, namespace: &str, hash: &str, ) -> Result<bool>
Check if a content hash already exists in a namespace (for exact-match deduplication)
Returns Ok(false) if:
- Table doesn’t exist yet
- Table has old schema without content_hash column (graceful degradation)
Sourcepub async fn has_source_hash(&self, namespace: &str, hash: &str) -> Result<bool>
pub async fn has_source_hash(&self, namespace: &str, hash: &str) -> Result<bool>
Check if any chunk in namespace already references the given source-document
hash. Used by the indexing pipeline to skip re-embedding files that were
already ingested (P4 — pre-index source-level dedup).
Returns Ok(false) if the table doesn’t exist yet, or if the table is on a
pre-v4 schema without the source_hash column (graceful degradation —
older namespaces should be backfilled via /admin/backfill-hashes).
Sourcepub async fn filter_existing_hashes<'a>(
&self,
namespace: &str,
hashes: &'a [String],
) -> Result<Vec<&'a String>>
pub async fn filter_existing_hashes<'a>( &self, namespace: &str, hashes: &'a [String], ) -> Result<Vec<&'a String>>
Filter a list of hashes to return only those that don’t exist in the namespace. This is more efficient than calling has_content_hash for each hash individually.
Returns all hashes as “new” if table has old schema without content_hash column.
Sourcepub async fn optimize(&self) -> Result<OptimizeStats>
pub async fn optimize(&self) -> Result<OptimizeStats>
Run all optimizations (compact + prune old versions)
Sourcepub async fn compact(&self) -> Result<OptimizeStats>
pub async fn compact(&self) -> Result<OptimizeStats>
Compact small files into larger ones for better performance
Sourcepub async fn cleanup(
&self,
older_than_days: Option<u64>,
) -> Result<OptimizeStats>
pub async fn cleanup( &self, older_than_days: Option<u64>, ) -> Result<OptimizeStats>
Remove old versions older than specified duration (default: 7 days)
Sourcepub async fn stats(&self) -> Result<TableStats>
pub async fn stats(&self) -> Result<TableStats>
Get table statistics (row count, fragments, etc.)
Sourcepub async fn count_namespace(&self, namespace: &str) -> Result<usize>
pub async fn count_namespace(&self, namespace: &str) -> Result<usize>
Count rows in a specific namespace
Sourcepub async fn get_all_in_namespace(
&self,
namespace: &str,
) -> Result<Vec<ChromaDocument>>
pub async fn get_all_in_namespace( &self, namespace: &str, ) -> Result<Vec<ChromaDocument>>
Get all documents from a namespace (for migration/export)
Note: This uses a full table scan with namespace filter. For very large namespaces, consider batching.
Sourcepub async fn namespace_exists(&self, namespace: &str) -> Result<bool>
pub async fn namespace_exists(&self, namespace: &str) -> Result<bool>
Check if a namespace exists (has any documents)
Auto Trait Implementations§
impl Freeze for StorageManager
impl !RefUnwindSafe for StorageManager
impl Send for StorageManager
impl Sync for StorageManager
impl Unpin for StorageManager
impl UnsafeUnpin for StorageManager
impl !UnwindSafe for StorageManager
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<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.