pub struct UnifiedIndex { /* private fields */ }Expand description
Unified index for cross-storage lookups
Maintains bidirectional mappings between all storage types:
- Nodes ↔ Vectors
- Nodes ↔ Rows
- Vectors ↔ Rows (via nodes or direct)
Implementations§
Source§impl UnifiedIndex
impl UnifiedIndex
Sourcepub fn new() -> UnifiedIndex
pub fn new() -> UnifiedIndex
Create a new empty unified index
Sourcepub fn link_node_to_vector(
&self,
node_id: &str,
collection: &str,
vector_id: u64,
)
pub fn link_node_to_vector( &self, node_id: &str, collection: &str, vector_id: u64, )
Link a node to a vector embedding
Sourcepub fn get_node_vectors(&self, node_id: &str) -> Vec<VectorKey>
pub fn get_node_vectors(&self, node_id: &str) -> Vec<VectorKey>
Get all vectors linked to a node
Sourcepub fn get_vector_node(
&self,
collection: &str,
vector_id: u64,
) -> Option<String>
pub fn get_vector_node( &self, collection: &str, vector_id: u64, ) -> Option<String>
Get the node linked to a vector
Sourcepub fn unlink_node_from_vector(
&self,
node_id: &str,
collection: &str,
vector_id: u64,
)
pub fn unlink_node_from_vector( &self, node_id: &str, collection: &str, vector_id: u64, )
Unlink a node from a vector
Sourcepub fn link_node_to_row(&self, node_id: &str, table: &str, row_id: u64)
pub fn link_node_to_row(&self, node_id: &str, table: &str, row_id: u64)
Link a node to a table row
Sourcepub fn get_node_rows(&self, node_id: &str) -> Vec<RowKey>
pub fn get_node_rows(&self, node_id: &str) -> Vec<RowKey>
Get all rows linked to a node
Sourcepub fn get_row_node(&self, table: &str, row_id: u64) -> Option<String>
pub fn get_row_node(&self, table: &str, row_id: u64) -> Option<String>
Get the node linked to a row
Sourcepub fn unlink_node_from_row(&self, node_id: &str, table: &str, row_id: u64)
pub fn unlink_node_from_row(&self, node_id: &str, table: &str, row_id: u64)
Unlink a node from a row
Sourcepub fn register_edge(&self, edge_id: &str, source_node: &str, target_node: &str)
pub fn register_edge(&self, edge_id: &str, source_node: &str, target_node: &str)
Register an edge with its source and target nodes
Sourcepub fn get_edge_nodes(&self, edge_id: &str) -> Option<(String, String)>
pub fn get_edge_nodes(&self, edge_id: &str) -> Option<(String, String)>
Get the nodes connected by an edge
Sourcepub fn unregister_edge(&self, edge_id: &str)
pub fn unregister_edge(&self, edge_id: &str)
Unregister an edge
Sourcepub fn link_vector_to_row(
&self,
collection: &str,
vector_id: u64,
table: &str,
row_id: u64,
)
pub fn link_vector_to_row( &self, collection: &str, vector_id: u64, table: &str, row_id: u64, )
Link a vector directly to a table row
Sourcepub fn get_vector_row(&self, collection: &str, vector_id: u64) -> Option<RowKey>
pub fn get_vector_row(&self, collection: &str, vector_id: u64) -> Option<RowKey>
Get the row linked to a vector
Sourcepub fn get_row_vectors(&self, table: &str, row_id: u64) -> Vec<VectorKey>
pub fn get_row_vectors(&self, table: &str, row_id: u64) -> Vec<VectorKey>
Get all vectors linked to a row
Sourcepub fn resolve(&self, source: &StorageRef) -> Vec<StorageRef>
pub fn resolve(&self, source: &StorageRef) -> Vec<StorageRef>
Resolve a storage reference to all related references
This performs transitive lookups:
- Given a node, returns linked vectors and rows
- Given a vector, returns linked node and row
- Given a row, returns linked node and vectors
Sourcepub fn resolve_transitive(
&self,
source: &StorageRef,
max_depth: usize,
) -> Vec<StorageRef>
pub fn resolve_transitive( &self, source: &StorageRef, max_depth: usize, ) -> Vec<StorageRef>
Resolve with transitive closure (up to max_depth)
Follows references recursively to find all related elements.
Sourcepub fn remove_node(&self, node_id: &str)
pub fn remove_node(&self, node_id: &str)
Remove all references to a node
Sourcepub fn remove_vector(&self, collection: &str, vector_id: u64)
pub fn remove_vector(&self, collection: &str, vector_id: u64)
Remove all references to a vector
Sourcepub fn stats(&self) -> UnifiedIndexStats
pub fn stats(&self) -> UnifiedIndexStats
Get statistics about the index
Trait Implementations§
Source§impl Default for UnifiedIndex
impl Default for UnifiedIndex
Source§fn default() -> UnifiedIndex
fn default() -> UnifiedIndex
Auto Trait Implementations§
impl !Freeze for UnifiedIndex
impl Forget for UnifiedIndex
impl Move for UnifiedIndex
impl RefUnwindSafe for UnifiedIndexwhere
RwLock<HashMap<String, Vec<VectorKey>>>: RefUnwindSafe,
RwLock<HashMap<VectorKey, String>>: RefUnwindSafe,
RwLock<HashMap<String, Vec<RowKey>>>: RefUnwindSafe,
RwLock<HashMap<RowKey, String>>: RefUnwindSafe,
RwLock<HashMap<String, (String, String)>>: RefUnwindSafe,
RwLock<HashMap<VectorKey, RowKey>>: RefUnwindSafe,
RwLock<HashMap<RowKey, Vec<VectorKey>>>: RefUnwindSafe,
impl Send for UnifiedIndexwhere
RwLock<HashMap<String, Vec<VectorKey>>>: Send,
RwLock<HashMap<VectorKey, String>>: Send,
RwLock<HashMap<String, Vec<RowKey>>>: Send,
RwLock<HashMap<RowKey, String>>: Send,
RwLock<HashMap<String, (String, String)>>: Send,
RwLock<HashMap<VectorKey, RowKey>>: Send,
RwLock<HashMap<RowKey, Vec<VectorKey>>>: Send,
impl Sync for UnifiedIndexwhere
RwLock<HashMap<String, Vec<VectorKey>>>: Sync,
RwLock<HashMap<VectorKey, String>>: Sync,
RwLock<HashMap<String, Vec<RowKey>>>: Sync,
RwLock<HashMap<RowKey, String>>: Sync,
RwLock<HashMap<String, (String, String)>>: Sync,
RwLock<HashMap<VectorKey, RowKey>>: Sync,
RwLock<HashMap<RowKey, Vec<VectorKey>>>: Sync,
impl Unpin for UnifiedIndex
impl UnsafeUnpin for UnifiedIndexwhere
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, Vec<VectorKey>)>: UnsafeUnpin,
PhantomData<(VectorKey, String)>: UnsafeUnpin,
PhantomData<(String, Vec<RowKey>)>: UnsafeUnpin,
PhantomData<(RowKey, String)>: UnsafeUnpin,
PhantomData<(String, (String, String))>: UnsafeUnpin,
PhantomData<(VectorKey, RowKey)>: UnsafeUnpin,
PhantomData<(RowKey, Vec<VectorKey>)>: UnsafeUnpin,
impl UnwindSafe for UnifiedIndexwhere
RwLock<HashMap<String, Vec<VectorKey>>>: UnwindSafe,
RwLock<HashMap<VectorKey, String>>: UnwindSafe,
RwLock<HashMap<String, Vec<RowKey>>>: UnwindSafe,
RwLock<HashMap<RowKey, String>>: UnwindSafe,
RwLock<HashMap<String, (String, String)>>: UnwindSafe,
RwLock<HashMap<VectorKey, RowKey>>: UnwindSafe,
RwLock<HashMap<RowKey, Vec<VectorKey>>>: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request