pub struct HotIndex { /* private fields */ }Expand description
分片热层索引 —— 将ID哈希路由到对应分片,减少全局锁竞争
Implementations§
Source§impl HotIndex
impl HotIndex
pub fn new(cfg: &HotConfig) -> Result<Self>
pub fn add_sync(&self, id: String, vec: Vec<f32>) -> Result<()>
Sourcepub async fn write_batch(
&self,
items: Vec<(String, Vec<f32>)>,
trace_id: String,
) -> Result<()>
pub async fn write_batch( &self, items: Vec<(String, Vec<f32>)>, trace_id: String, ) -> Result<()>
异步批量写入(经由背景协程,避免阻塞调用方)
pub fn remove(&self, id: &str) -> Option<Vec<f32>>
pub fn get(&self, id: &str) -> Option<Vec<f32>>
pub fn touch(&self, id: &str)
pub fn contains(&self, id: &str) -> bool
pub fn len(&self) -> usize
Sourcepub fn collect_evictions(&self) -> Vec<String>
pub fn collect_evictions(&self) -> Vec<String>
返回所有超出容量被驱逐的ID(由波动引擎处理后续迁移)
Auto Trait Implementations§
impl Freeze for HotIndex
impl !RefUnwindSafe for HotIndex
impl Send for HotIndex
impl Sync for HotIndex
impl Unpin for HotIndex
impl UnsafeUnpin for HotIndex
impl !UnwindSafe for HotIndex
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