use async_trait::async_trait;
use crate::entry::{ContextEntry, ScoredEntry};
use crate::error::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[async_trait]
pub trait ContextStorage: Send + Sync {
async fn save(&self, entry: &ContextEntry) -> Result<()>;
async fn get_top_k(&self, k: usize) -> Result<Vec<ContextEntry>>;
async fn get_all(&self) -> Result<Vec<ContextEntry>>;
async fn delete(&self, id: &str) -> Result<bool>;
async fn clear(&self) -> Result<usize>;
async fn clear_scope(&self, scope: &str) -> Result<usize>;
async fn count(&self) -> Result<usize>;
}
#[async_trait]
pub trait Searcher: Send + Sync {
async fn search(
&self,
query: &str,
scope: Option<&str>,
limit: usize,
) -> Result<Vec<ScoredEntry>>;
}