pub struct HybridBackend { /* private fields */ }Expand description
Hybrid vector backend combining HNSW (hot) + DiskANN (cold).
§Data flow
- Insert: vector goes to DiskANN (always) and HNSW (if under hot capacity).
- Search: query both tiers, fuse ranks via Reciprocal Rank Fusion (RRF; WEFT-661), deduplicate by numeric ID.
- Promotion: access counts are tracked per ID. When a cold-only
vector exceeds
promotion_thresholdaccesses, it is copied into the hot tier. - Eviction: when HNSW exceeds
hot_capacity, the LRU entry is evicted (it remains in DiskANN).
Implementations§
Source§impl HybridBackend
impl HybridBackend
Sourcepub fn new(
hnsw_config: HnswServiceConfig,
diskann_config: DiskAnnConfig,
hybrid_config: HybridConfig,
) -> Self
pub fn new( hnsw_config: HnswServiceConfig, diskann_config: DiskAnnConfig, hybrid_config: HybridConfig, ) -> Self
Create a new hybrid backend.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with all-default configurations.
Sourcepub fn config(&self) -> &HybridConfig
pub fn config(&self) -> &HybridConfig
Borrow the hybrid configuration.
Trait Implementations§
Source§impl Debug for HybridBackend
impl Debug for HybridBackend
Source§impl VectorBackend for HybridBackend
impl VectorBackend for HybridBackend
Source§fn insert(
&self,
id: u64,
key: &str,
vector: &[f32],
metadata: Value,
) -> VectorResult<()>
fn insert( &self, id: u64, key: &str, vector: &[f32], metadata: Value, ) -> VectorResult<()>
Insert a vector with the given numeric ID, string key, and metadata. Read more
Source§fn backend_name(&self) -> &str
fn backend_name(&self) -> &str
Return a human-readable name for this backend (e.g. “hnsw”, “diskann”, “hybrid”).
Source§fn current_epoch(&self) -> u64
fn current_epoch(&self) -> u64
Return the current monotonic epoch. Read more
Source§fn insert_with_epoch(
&self,
id: u64,
key: &str,
vector: &[f32],
metadata: Value,
parent_epoch: u64,
) -> VectorResult<()>
fn insert_with_epoch( &self, id: u64, key: &str, vector: &[f32], metadata: Value, parent_epoch: u64, ) -> VectorResult<()>
Insert a vector only if the store’s current epoch matches
parent_epoch. If the epoch has advanced past parent_epoch,
the call is rejected with VectorError::EpochConflict. Read moreSource§fn soft_delete(&self, id: u64) -> bool
fn soft_delete(&self, id: u64) -> bool
Mark a vector as tombstoned instead of physically removing it. Read more
Source§fn compact(&self, older_than_epoch: u64) -> usize
fn compact(&self, older_than_epoch: u64) -> usize
Physically remove tombstones whose deletion epoch is older than
older_than_epoch. Returns the number of entries purged.Source§fn tombstone_count(&self) -> usize
fn tombstone_count(&self) -> usize
Return the number of tombstoned (soft-deleted) entries.
Source§fn max_vectors(&self) -> Option<usize>
fn max_vectors(&self) -> Option<usize>
Return the configured maximum number of vectors, or
None if
unbounded.Source§fn set_max_vectors(&self, limit: Option<usize>)
fn set_max_vectors(&self, limit: Option<usize>)
Set the maximum number of vectors. Pass
None for unbounded.Auto Trait Implementations§
impl !Freeze for HybridBackend
impl !RefUnwindSafe for HybridBackend
impl Send for HybridBackend
impl Sync for HybridBackend
impl Unpin for HybridBackend
impl UnsafeUnpin for HybridBackend
impl UnwindSafe for HybridBackend
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> 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