Skip to main content

ringdb/
config.rs

1/// Which compute backend to use for ring queries.
2///
3/// Only CPU is supported for now. This enum exists so the config is ready
4/// to be extended with additional backends later.
5#[derive(Debug, Clone, Default, PartialEq, Eq)]
6pub enum BackendPreference {
7    /// CPU brute-force (always available).
8    #[default]
9    Cpu,
10}
11
12/// Configuration for a `RingDb` instance.
13#[derive(Debug, Clone)]
14pub struct RingDbConfig {
15    /// Number of dimensions per vector. Must be > 0.
16    pub dims: usize,
17    /// Backend selection strategy.
18    pub backend_preference: BackendPreference,
19}
20
21impl RingDbConfig {
22    /// Create a config with default settings (CPU backend).
23    pub fn new(dims: usize) -> Self {
24        Self {
25            dims,
26            backend_preference: BackendPreference::Cpu,
27        }
28    }
29}