pub struct SemanticDht { /* private fields */ }Expand description
Semantic DHT manager
Implementations§
Source§impl SemanticDht
impl SemanticDht
Sourcepub fn new(config: SemanticDhtConfig) -> Self
pub fn new(config: SemanticDhtConfig) -> Self
Create a new semantic DHT
Sourcepub fn register_namespace(
&self,
namespace: SemanticNamespace,
) -> Result<(), SemanticDhtError>
pub fn register_namespace( &self, namespace: SemanticNamespace, ) -> Result<(), SemanticDhtError>
Register a new semantic namespace
Sourcepub fn compute_lsh_hashes(
&self,
embedding: &[f32],
namespace: &NamespaceId,
) -> Result<Vec<LshHash>, SemanticDhtError>
pub fn compute_lsh_hashes( &self, embedding: &[f32], namespace: &NamespaceId, ) -> Result<Vec<LshHash>, SemanticDhtError>
Compute LSH hashes for an embedding
Sourcepub fn index_content(
&self,
cid: Cid,
embedding: Vec<f32>,
namespace: NamespaceId,
) -> Result<(), SemanticDhtError>
pub fn index_content( &self, cid: Cid, embedding: Vec<f32>, namespace: NamespaceId, ) -> Result<(), SemanticDhtError>
Index content with its embedding
Sourcepub fn query(
&self,
query: SemanticQuery,
) -> Result<Vec<SemanticResult>, SemanticDhtError>
pub fn query( &self, query: SemanticQuery, ) -> Result<Vec<SemanticResult>, SemanticDhtError>
Execute a semantic query
Sourcepub fn stats(&self) -> SemanticDhtStats
pub fn stats(&self) -> SemanticDhtStats
Get statistics
Sourcepub fn get_namespace(&self, id: &NamespaceId) -> Option<SemanticNamespace>
pub fn get_namespace(&self, id: &NamespaceId) -> Option<SemanticNamespace>
Get namespace information
Sourcepub fn list_namespaces(&self) -> Vec<NamespaceId>
pub fn list_namespaces(&self) -> Vec<NamespaceId>
List all registered namespaces
Auto Trait Implementations§
impl Freeze for SemanticDht
impl !RefUnwindSafe for SemanticDht
impl Send for SemanticDht
impl Sync for SemanticDht
impl Unpin for SemanticDht
impl !UnwindSafe for SemanticDht
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more