diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-01-24 23:06:33 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-01-24 23:06:33 +0100 |
| commit | 2bcccb18a6cb8bf836f57c3d86f759b19699def2 (patch) | |
| tree | ef55a10c6d9703677a983b8ca900fb4578a08eb3 /cache | |
| parent | b2e88a8beabf04adc28947cf82996e8692a68b71 (diff) | |
| download | jellything-2bcccb18a6cb8bf836f57c3d86f759b19699def2.tar jellything-2bcccb18a6cb8bf836f57c3d86f759b19699def2.tar.bz2 jellything-2bcccb18a6cb8bf836f57c3d86f759b19699def2.tar.zst | |
cache as object
Diffstat (limited to 'cache')
| -rw-r--r-- | cache/src/lib.rs | 8 | ||||
| -rw-r--r-- | cache/tools/Cargo.toml | 16 | ||||
| -rw-r--r-- | cache/tools/cache_fs_to_rocksdb.rs (renamed from cache/src/bin/cache_fs_to_rocksdb.rs) | 0 | ||||
| -rw-r--r-- | cache/tools/cache_rocksdb_delete_prefix.rs (renamed from cache/src/bin/cache_rocksdb_delete_prefix.rs) | 0 |
4 files changed, 18 insertions, 6 deletions
diff --git a/cache/src/lib.rs b/cache/src/lib.rs index be2b331..4d6bbcf 100644 --- a/cache/src/lib.rs +++ b/cache/src/lib.rs @@ -81,14 +81,10 @@ impl Cache { Ok(out) } - pub fn cache_read(&self, key: &str) -> Result<Option<Vec<u8>>> { + pub fn read(&self, key: &str) -> Result<Option<Vec<u8>>> { self.storage.read(key) } - pub fn cache_store( - &self, - key: String, - generate: impl FnOnce() -> Result<Vec<u8>>, - ) -> Result<String> { + pub fn store(&self, key: String, generate: impl FnOnce() -> Result<Vec<u8>>) -> Result<String> { self.cache(&key, generate)?; Ok(key) } diff --git a/cache/tools/Cargo.toml b/cache/tools/Cargo.toml new file mode 100644 index 0000000..8f249b5 --- /dev/null +++ b/cache/tools/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "tools" +version = "0.1.0" +edition = "2024" + +[dependencies] +rocksdb = { version = "0.24.0", features = ["multi-threaded-cf"] } +anyhow = "1.0.100" + +[[bin]] +name = "cache_fs_to_rocksdb" +path = "cache_fs_to_rocksdb.rs" + +[[bin]] +name = "cache_rocksdb_delete_prefix" +path = "cache_rocksdb_delete_prefix.rs" diff --git a/cache/src/bin/cache_fs_to_rocksdb.rs b/cache/tools/cache_fs_to_rocksdb.rs index d283dcb..d283dcb 100644 --- a/cache/src/bin/cache_fs_to_rocksdb.rs +++ b/cache/tools/cache_fs_to_rocksdb.rs diff --git a/cache/src/bin/cache_rocksdb_delete_prefix.rs b/cache/tools/cache_rocksdb_delete_prefix.rs index e09ce61..e09ce61 100644 --- a/cache/src/bin/cache_rocksdb_delete_prefix.rs +++ b/cache/tools/cache_rocksdb_delete_prefix.rs |