From 4f1fe5404c954c85f3bc2379c7ae130b57ea5e73 Mon Sep 17 00:00:00 2001 From: Vika Date: Wed, 28 Aug 2024 15:01:57 +0300 Subject: Introduce `Storage::update_with` This function takes a closure that modifies the post. This could be useful in maintenance utilities that scan and fixup posts. For now this isn't used anywhere within Kittybox, but once all backends implement this correctly, this could replace `Storage::update_post` calls. For supporting backends, `Storage::update_post` is implemented in terms of `Storage::update_with`. --- src/database/file/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/database/file') diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs index cf7380f..6343f1f 100644 --- a/src/database/file/mod.rs +++ b/src/database/file/mod.rs @@ -484,6 +484,13 @@ impl Storage for FileStorage { Ok(()) } + #[tracing::instrument(skip(self, f), fields(f = std::any::type_name::()))] + async fn update_with( + &self, url: &str, f: F + ) -> Result<(serde_json::Value, serde_json::Value)> { + todo!("update_with is not yet implemented due to special requirements of the file backend") + } + #[tracing::instrument(skip(self))] async fn get_channels(&self, user: &url::Url) -> Result> { let mut path = relative_path::RelativePathBuf::new(); -- cgit 1.4.1