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 RefUnwindSafe for UnifiedIndex
impl Send for UnifiedIndex
impl Sync for UnifiedIndex
impl Unpin for UnifiedIndex
impl UnsafeUnpin for UnifiedIndex
impl UnwindSafe for UnifiedIndex
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> 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