use crate::error::Result;
pub mod cpu;
pub use cpu::CpuBackend;
pub(crate) struct QueryResponse {
pub(crate) id: u32,
pub(crate) dist_sq: f32,
}
pub trait RingComputeBackend: Send + Sync {
fn name(&self) -> &'static str;
fn upload_f32_dataset(
&mut self,
dims: usize,
vectors: Vec<f32>,
norms_sq: Vec<f32>,
) -> Result<()>;
fn ring_query_f32(
&self,
dims: usize,
query: &[f32],
d_min: f32,
d_max: f32,
) -> Result<Vec<QueryResponse>>;
fn disk_query_f32(&self, dims: usize, query: &[f32], d_max: f32) -> Result<Vec<QueryResponse>> {
self.ring_query_f32(dims, query, 0.0, d_max)
}
}