1use async_trait::async_trait;
4use uuid::Uuid;
5
6use khive_types::SubstrateKind;
7
8use crate::types::{
9 BatchWriteSummary, SparseRecord, SparseSearchHit, SparseSearchRequest, SparseVector,
10 StorageResult,
11};
12
13#[async_trait]
15pub trait SparseStore: Send + Sync + 'static {
16 async fn insert_sparse(
18 &self,
19 subject_id: Uuid,
20 kind: SubstrateKind,
21 namespace: &str,
22 field: &str,
23 vector: SparseVector,
24 ) -> StorageResult<()>;
25
26 async fn insert_batch(&self, records: Vec<SparseRecord>) -> StorageResult<BatchWriteSummary>;
28
29 async fn delete(&self, subject_id: Uuid) -> StorageResult<bool>;
31
32 async fn search_sparse(
34 &self,
35 request: SparseSearchRequest,
36 ) -> StorageResult<Vec<SparseSearchHit>>;
37
38 async fn count(&self) -> StorageResult<u64>;
40}