1use async_trait::async_trait;
4use uuid::Uuid;
5
6use khive_types::SubstrateKind;
7
8use crate::types::{
9 BatchWriteSummary, IndexRebuildScope, StorageResult, VectorRecord, VectorSearchHit,
10 VectorSearchRequest, VectorStoreInfo,
11};
12
13#[async_trait]
14pub trait VectorStore: Send + Sync + 'static {
15 async fn insert(
16 &self,
17 subject_id: Uuid,
18 kind: SubstrateKind,
19 namespace: &str,
20 embedding: Vec<f32>,
21 ) -> StorageResult<()>;
22 async fn insert_batch(&self, records: Vec<VectorRecord>) -> StorageResult<BatchWriteSummary>;
23 async fn delete(&self, subject_id: Uuid) -> StorageResult<bool>;
24 async fn count(&self) -> StorageResult<u64>;
25 async fn search(&self, request: VectorSearchRequest) -> StorageResult<Vec<VectorSearchHit>>;
26 async fn info(&self) -> StorageResult<VectorStoreInfo>;
27 async fn rebuild(&self, scope: IndexRebuildScope) -> StorageResult<VectorStoreInfo>;
28}