diff --git a/meilidb-data/src/database/custom_settings.rs b/meilidb-data/src/database/custom_settings.rs index b9227d0bb..112d1b327 100644 --- a/meilidb-data/src/database/custom_settings.rs +++ b/meilidb-data/src/database/custom_settings.rs @@ -1,13 +1,22 @@ use std::sync::Arc; -use std::ops::Deref; +use rocksdb::DBVector; #[derive(Clone)] pub struct CustomSettings(pub Arc, pub String); -impl Deref for CustomSettings { - type Target = rocksdb::DB; +impl CustomSettings { + pub fn set(&self, key: K, value: V) -> Result<(), rocksdb::Error> + where K: AsRef<[u8]>, + V: AsRef<[u8]>, + { + let cf = self.0.cf_handle(&self.1).unwrap(); + self.0.put_cf(cf, key, value) + } - fn deref(&self) -> &Self::Target { - &self.0 + pub fn get(&self, key: K) -> Result, rocksdb::Error> + where K: AsRef<[u8]>, + { + let cf = self.0.cf_handle(&self.1).unwrap(); + self.0.get_cf(cf, key) } }