/* This file is part of jellything (https://codeberg.org/metamuffin/jellything) which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2025 metamuffin */ use crate::{Config, backends::CacheStorage}; use anyhow::Result; use rocksdb::DB; pub struct Rocksdb(DB); impl Rocksdb { pub fn new(config: &Config) -> Result { Ok(Self(rocksdb::DB::open_default(config.path.clone())?)) } } impl CacheStorage for Rocksdb { fn store(&self, key: String, value: &[u8]) -> Result<()> { Ok(self.0.put(key, value)?) } fn read(&self, key: &str) -> Result>> { Ok(self.0.get(key)?) } }