pub struct StorageManager {
pub config: UniConfig,
pub compaction_status: Arc<Mutex<CompactionStatus>>,
/* private fields */
}Fields§
§config: UniConfig§compaction_status: Arc<Mutex<CompactionStatus>>Implementations§
Source§impl StorageManager
impl StorageManager
Sourcepub async fn new(
base_uri: &str,
schema_manager: Arc<SchemaManager>,
) -> Result<Self>
pub async fn new( base_uri: &str, schema_manager: Arc<SchemaManager>, ) -> Result<Self>
Create a new StorageManager with LanceDB integration.
Sourcepub async fn new_with_cache(
base_uri: &str,
schema_manager: Arc<SchemaManager>,
adjacency_cache_size: usize,
) -> Result<Self>
pub async fn new_with_cache( base_uri: &str, schema_manager: Arc<SchemaManager>, adjacency_cache_size: usize, ) -> Result<Self>
Create a new StorageManager with custom cache size.
Sourcepub async fn new_with_config(
base_uri: &str,
schema_manager: Arc<SchemaManager>,
config: UniConfig,
) -> Result<Self>
pub async fn new_with_config( base_uri: &str, schema_manager: Arc<SchemaManager>, config: UniConfig, ) -> Result<Self>
Create a new StorageManager with custom configuration.
Sourcepub async fn new_with_store_and_config(
base_uri: &str,
store: Arc<dyn ObjectStore>,
schema_manager: Arc<SchemaManager>,
config: UniConfig,
) -> Result<Self>
pub async fn new_with_store_and_config( base_uri: &str, store: Arc<dyn ObjectStore>, schema_manager: Arc<SchemaManager>, config: UniConfig, ) -> Result<Self>
Create a new StorageManager using an already-constructed object store.
This is used by higher layers that need explicit store configuration (for example custom S3 endpoints in hybrid/cloud modes).
Sourcepub async fn new_with_store_and_storage_options(
base_uri: &str,
store: Arc<dyn ObjectStore>,
schema_manager: Arc<SchemaManager>,
config: UniConfig,
lancedb_storage_options: Option<HashMap<String, String>>,
) -> Result<Self>
pub async fn new_with_store_and_storage_options( base_uri: &str, store: Arc<dyn ObjectStore>, schema_manager: Arc<SchemaManager>, config: UniConfig, lancedb_storage_options: Option<HashMap<String, String>>, ) -> Result<Self>
Create a new StorageManager using an already-constructed object store and explicit LanceDB storage options.
pub fn pinned(&self, snapshot: SnapshotManifest) -> Self
pub fn get_edge_version_by_id(&self, edge_type_id: u32) -> Option<u64>
Sourcepub fn version_high_water_mark(&self) -> Option<u64>
pub fn version_high_water_mark(&self) -> Option<u64>
Returns the version_high_water_mark from the pinned snapshot if present.
This is used for time-travel queries to filter data by version.
When a snapshot is pinned, only rows with _version <= version_high_water_mark
should be considered visible.
Sourcepub fn apply_version_filter(&self, base_filter: String) -> String
pub fn apply_version_filter(&self, base_filter: String) -> String
Apply version filtering to a base filter expression.
If a snapshot is pinned, wraps base_filter with an additional
_version <= hwm clause. Otherwise returns base_filter unchanged.
pub fn store(&self) -> Arc<dyn ObjectStore>
Sourcepub fn compaction_status(&self) -> Result<CompactionStatus, LockPoisonedError>
pub fn compaction_status(&self) -> Result<CompactionStatus, LockPoisonedError>
Get current compaction status.
§Errors
Returns error if the compaction status lock is poisoned (see issue #18/#150).
pub async fn compact(&self) -> Result<CompactionStats>
pub async fn compact_label(&self, label: &str) -> Result<CompactionStats>
pub async fn compact_edge_type( &self, edge_type: &str, ) -> Result<CompactionStats>
pub async fn wait_for_compaction(&self) -> Result<()>
pub fn start_background_compaction( self: Arc<Self>, shutdown_rx: Receiver<()>, ) -> JoinHandle<()>
Sourcepub async fn get_cached_table(&self, label: &str) -> Result<Table>
pub async fn get_cached_table(&self, label: &str) -> Result<Table>
Get or open a cached table for a label
Sourcepub fn invalidate_table_cache(&self, label: &str)
pub fn invalidate_table_cache(&self, label: &str)
Invalidate cached table (call after writes)
Sourcepub fn clear_table_cache(&self)
pub fn clear_table_cache(&self)
Clear all cached tables
pub fn base_path(&self) -> &str
pub fn schema_manager(&self) -> &SchemaManager
pub fn schema_manager_arc(&self) -> Arc<SchemaManager>
Sourcepub fn adjacency_manager(&self) -> Arc<AdjacencyManager>
pub fn adjacency_manager(&self) -> Arc<AdjacencyManager>
Get the adjacency manager for the dual-CSR architecture.
Sourcepub async fn warm_adjacency(
&self,
edge_type_id: u32,
direction: Direction,
version: Option<u64>,
) -> Result<()>
pub async fn warm_adjacency( &self, edge_type_id: u32, direction: Direction, version: Option<u64>, ) -> Result<()>
Warm the adjacency manager for a specific edge type and direction.
Builds the Main CSR from L2 adjacency + L1 delta data in storage. Called lazily on first access per edge type or at startup.
Sourcepub async fn warm_adjacency_coalesced(
&self,
edge_type_id: u32,
direction: Direction,
version: Option<u64>,
) -> Result<()>
pub async fn warm_adjacency_coalesced( &self, edge_type_id: u32, direction: Direction, version: Option<u64>, ) -> Result<()>
Coalesced warm_adjacency() to prevent cache stampede (Issue #13).
Uses double-checked locking to ensure only one concurrent warm() per (edge_type, direction) key. Subsequent callers wait for the first to complete.
Sourcepub fn has_adjacency_csr(&self, edge_type_id: u32, direction: Direction) -> bool
pub fn has_adjacency_csr(&self, edge_type_id: u32, direction: Direction) -> bool
Check whether the adjacency manager has a CSR for the given edge type and direction.
Sourcepub fn get_neighbors_at_version(
&self,
vid: Vid,
edge_type: u32,
direction: Direction,
version: u64,
) -> Vec<(Vid, Eid)>
pub fn get_neighbors_at_version( &self, vid: Vid, edge_type: u32, direction: Direction, version: u64, ) -> Vec<(Vid, Eid)>
Get neighbors at a specific version for snapshot queries.
Sourcepub fn lancedb_store(&self) -> &LanceDbStore
pub fn lancedb_store(&self) -> &LanceDbStore
Get the LanceDB store.
Sourcepub fn lancedb_store_arc(&self) -> Arc<LanceDbStore>
pub fn lancedb_store_arc(&self) -> Arc<LanceDbStore>
Get the LanceDB store as an Arc.
Sourcepub fn get_labels_from_index(&self, vid: Vid) -> Option<Vec<String>>
pub fn get_labels_from_index(&self, vid: Vid) -> Option<Vec<String>>
Get labels for a VID from the in-memory index. Returns None if the index is disabled or the VID is not found.
Sourcepub fn update_vid_labels_index(&self, vid: Vid, labels: Vec<String>)
pub fn update_vid_labels_index(&self, vid: Vid, labels: Vec<String>)
Update the VID-to-labels mapping in the index. No-op if the index is disabled.
Sourcepub fn remove_from_vid_labels_index(&self, vid: Vid)
pub fn remove_from_vid_labels_index(&self, vid: Vid)
Remove a VID from the labels index. No-op if the index is disabled.
pub async fn load_subgraph_cached( &self, start_vids: &[Vid], edge_types: &[u32], max_hops: usize, direction: GraphDirection, _l0: Option<Arc<RwLock<L0Buffer>>>, ) -> Result<WorkingGraph>
pub fn snapshot_manager(&self) -> &SnapshotManager
pub fn index_manager(&self) -> IndexManager
pub fn vertex_dataset(&self, label: &str) -> Result<VertexDataset>
pub fn edge_dataset( &self, edge_type: &str, src_label: &str, dst_label: &str, ) -> Result<EdgeDataset>
pub fn delta_dataset( &self, edge_type: &str, direction: &str, ) -> Result<DeltaDataset>
pub fn adjacency_dataset( &self, edge_type: &str, label: &str, direction: &str, ) -> Result<AdjacencyDataset>
Sourcepub fn main_vertex_dataset(&self) -> MainVertexDataset
pub fn main_vertex_dataset(&self) -> MainVertexDataset
Get the main vertex dataset for unified vertex storage.
The main vertex dataset contains all vertices regardless of label, enabling fast ID-based lookups without knowing the label.
Sourcepub fn main_edge_dataset(&self) -> MainEdgeDataset
pub fn main_edge_dataset(&self) -> MainEdgeDataset
Get the main edge dataset for unified edge storage.
The main edge dataset contains all edges regardless of type, enabling fast ID-based lookups without knowing the edge type.
pub fn uid_index(&self, label: &str) -> Result<UidIndex>
pub async fn inverted_index( &self, label: &str, property: &str, ) -> Result<InvertedIndex>
pub async fn vector_search( &self, label: &str, property: &str, query: &[f32], k: usize, filter: Option<&str>, ctx: Option<&QueryContext>, ) -> Result<Vec<(Vid, f32)>>
Sourcepub async fn fts_search(
&self,
label: &str,
property: &str,
query: &str,
k: usize,
filter: Option<&str>,
ctx: Option<&QueryContext>,
) -> Result<Vec<(Vid, f32)>>
pub async fn fts_search( &self, label: &str, property: &str, query: &str, k: usize, filter: Option<&str>, ctx: Option<&QueryContext>, ) -> Result<Vec<(Vid, f32)>>
Perform a full-text search with BM25 scoring.
Returns vertices matching the search query along with their BM25 scores. Results are sorted by score descending (most relevant first).
§Arguments
label- The label to search withinproperty- The property column to search (must have FTS index)query- The search query textk- Maximum number of results to returnfilter- Optional Lance filter expressionctx- Optional query context for visibility checks
§Returns
Vector of (Vid, score) tuples, where score is the BM25 relevance score.
pub async fn get_vertex_by_uid( &self, uid: &UniId, label: &str, ) -> Result<Option<Vid>>
pub async fn insert_vertex_with_uid( &self, label: &str, vid: Vid, uid: UniId, ) -> Result<()>
pub async fn load_subgraph( &self, start_vids: &[Vid], edge_types: &[u32], max_hops: usize, direction: GraphDirection, l0: Option<&L0Buffer>, ) -> Result<WorkingGraph>
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.