pub struct DistributedSearch { /* private fields */ }Expand description
Distributed search coordinator
Manages multiple shards and coordinates distributed queries.
Implementations§
Source§impl DistributedSearch
impl DistributedSearch
Sourcepub fn new(config: DistributedConfig) -> Self
pub fn new(config: DistributedConfig) -> Self
Create a new distributed search coordinator
Sourcepub fn add_shard(&mut self, shard: Shard)
pub fn add_shard(&mut self, shard: Shard)
Add a shard to the cluster.
Callers must ensure that each shard registered with this coordinator
has a unique ShardId and that the same shard is not added more
than once. Adding multiple shards with the same ShardId, or
registering the same shard repeatedly, may lead to incorrect query
results and statistics.
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Get number of registered shards
Sourcepub fn available_shard_count(&self) -> usize
pub fn available_shard_count(&self) -> usize
Get number of available shards
Sourcepub fn query(
&self,
query: &SparseVec,
k: usize,
) -> Result<(Vec<DistributedResult>, QueryStats), DistributedError>
pub fn query( &self, query: &SparseVec, k: usize, ) -> Result<(Vec<DistributedResult>, QueryStats), DistributedError>
Execute a distributed query
Sourcepub fn total_queries(&self) -> u64
pub fn total_queries(&self) -> u64
Get total queries executed
Sourcepub fn config(&self) -> &DistributedConfig
pub fn config(&self) -> &DistributedConfig
Get configuration
Trait Implementations§
Source§impl Default for DistributedSearch
impl Default for DistributedSearch
Source§fn default() -> DistributedSearch
fn default() -> DistributedSearch
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for DistributedSearch
impl RefUnwindSafe for DistributedSearch
impl Send for DistributedSearch
impl Sync for DistributedSearch
impl Unpin for DistributedSearch
impl UnwindSafe for DistributedSearch
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
Mutably borrows from an owned value. Read more
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