pub struct SemanticDHTNode { /* private fields */ }Expand description
Main semantic DHT node
Implementations§
Source§impl SemanticDHTNode
impl SemanticDHTNode
Sourcepub fn new(
config: SemanticDHTConfig,
local_peer_id: PeerId,
local_index: VectorIndex,
) -> Self
pub fn new( config: SemanticDHTConfig, local_peer_id: PeerId, local_index: VectorIndex, ) -> Self
Create a new semantic DHT node
Sourcepub async fn insert(&self, cid: &Cid, embedding: &[f32]) -> Result<()>
pub async fn insert(&self, cid: &Cid, embedding: &[f32]) -> Result<()>
Insert a vector into the local index and replicate to peers
Sourcepub fn search_local(
&self,
embedding: &[f32],
k: usize,
) -> Result<Vec<SearchResult>>
pub fn search_local( &self, embedding: &[f32], k: usize, ) -> Result<Vec<SearchResult>>
Search for nearest neighbors locally
Sourcepub async fn search_distributed(
&self,
embedding: &[f32],
k: usize,
) -> Result<Vec<SearchResult>>
pub async fn search_distributed( &self, embedding: &[f32], k: usize, ) -> Result<Vec<SearchResult>>
Distributed k-NN search across multiple peers
Sourcepub fn add_peer(&self, peer: SemanticPeer) -> Result<()>
pub fn add_peer(&self, peer: SemanticPeer) -> Result<()>
Add a peer to the routing table
Sourcepub fn remove_peer(&self, peer_id: &PeerId)
pub fn remove_peer(&self, peer_id: &PeerId)
Remove a peer from the routing table
Sourcepub fn update_clusters(&self, num_clusters: usize) -> Result<()>
pub fn update_clusters(&self, num_clusters: usize) -> Result<()>
Update peer clustering
Sourcepub fn stats(&self) -> SemanticDHTStats
pub fn stats(&self) -> SemanticDHTStats
Get DHT statistics
Sourcepub fn get_stats(&self) -> SemanticDHTStats
pub fn get_stats(&self) -> SemanticDHTStats
Get DHT statistics (alias for stats)
Sourcepub fn routing_table(&self) -> &SemanticRoutingTable
pub fn routing_table(&self) -> &SemanticRoutingTable
Get reference to the routing table
Sourcepub fn set_replication_strategy(&mut self, strategy: ReplicationStrategy)
pub fn set_replication_strategy(&mut self, strategy: ReplicationStrategy)
Set replication strategy
Sourcepub fn get_index_snapshot(&self) -> Vec<Cid> ⓘ
pub fn get_index_snapshot(&self) -> Vec<Cid> ⓘ
Get a snapshot of local index entries for synchronization Returns CIDs that can be used for delta synchronization
Sourcepub fn prepare_sync_delta(&self, peer_snapshot: &[Cid]) -> Vec<Cid> ⓘ
pub fn prepare_sync_delta(&self, peer_snapshot: &[Cid]) -> Vec<Cid> ⓘ
Prepare synchronization delta: entries that peer needs Returns CIDs that are in our index but not in the peer’s snapshot
Sourcepub async fn apply_sync_delta(&self, delta_cids: Vec<Cid>) -> Result<usize>
pub async fn apply_sync_delta(&self, delta_cids: Vec<Cid>) -> Result<usize>
Apply synchronization delta: add entries from peer This is a foundation - actual implementation would fetch embeddings from peer
Sourcepub async fn apply_sync_delta_with_embeddings(
&self,
delta_entries: Vec<(Cid, Vec<f32>)>,
) -> Result<usize>
pub async fn apply_sync_delta_with_embeddings( &self, delta_entries: Vec<(Cid, Vec<f32>)>, ) -> Result<usize>
Apply synchronization delta with embeddings: add entries from peer This method actually inserts the embeddings into the local index
Sourcepub fn sync_stats(&self) -> SyncStats
pub fn sync_stats(&self) -> SyncStats
Get synchronization statistics
Auto Trait Implementations§
impl Freeze for SemanticDHTNode
impl !RefUnwindSafe for SemanticDHTNode
impl Send for SemanticDHTNode
impl Sync for SemanticDHTNode
impl Unpin for SemanticDHTNode
impl !UnwindSafe for SemanticDHTNode
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> Pointable for T
impl<T> Pointable for T
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§fn to_subset_unchecked(&self) -> SS
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.