diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-01-24 04:31:48 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-01-24 04:31:48 +0100 |
| commit | b2e88a8beabf04adc28947cf82996e8692a68b71 (patch) | |
| tree | 23d66c8672b69cce7835ffabae4092669062ada8 /cache/src/backends/mod.rs | |
| parent | 774f64c0789529884dd7a5232f190e347ad29532 (diff) | |
| download | jellything-b2e88a8beabf04adc28947cf82996e8692a68b71.tar jellything-b2e88a8beabf04adc28947cf82996e8692a68b71.tar.bz2 jellything-b2e88a8beabf04adc28947cf82996e8692a68b71.tar.zst | |
move things around; kv crate
Diffstat (limited to 'cache/src/backends/mod.rs')
| -rw-r--r-- | cache/src/backends/mod.rs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/cache/src/backends/mod.rs b/cache/src/backends/mod.rs deleted file mode 100644 index 52a954b..0000000 --- a/cache/src/backends/mod.rs +++ /dev/null @@ -1,28 +0,0 @@ -/* - 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) 2026 metamuffin <metamuffin.org> -*/ -pub mod dummy; -pub mod filesystem; -pub mod rocksdb; - -use crate::{ - CONF, - backends::{dummy::Dummy, filesystem::Filesystem, rocksdb::Rocksdb}, -}; -use anyhow::{Result, bail}; - -pub(crate) trait CacheStorage: Send + Sync + 'static { - fn store(&self, key: String, value: &[u8]) -> Result<()>; - fn read(&self, key: &str) -> Result<Option<Vec<u8>>>; -} - -pub fn init_backend() -> Result<Box<dyn CacheStorage>> { - Ok(match CONF.driver.as_str() { - "filesystem" => Box::new(Filesystem::new(&CONF)), - "rocksdb" => Box::new(Rocksdb::new(&CONF)?), - "dummy" => Box::new(Dummy), - _ => bail!("unknown driver"), - }) -} |