about summary refs log tree commit diff
path: root/src/database/file
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2024-03-04 04:40:50 +0300
committerVika <vika@fireburn.ru>2024-03-04 04:40:50 +0300
commitefc10086cbb6726c3728c8edda93b8fd00436717 (patch)
tree749437e3a12181e5380a59e32b16fdbf78e87ba9 /src/database/file
parentb7f0140dc05e4b33352e0ea46db4b36c6bfb2894 (diff)
downloadkittybox-efc10086cbb6726c3728c8edda93b8fd00436717.tar.zst
Support ?q=category queries
Warning, untested. But hopefully works!
Diffstat (limited to 'src/database/file')
-rw-r--r--src/database/file/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs
index 27d3da1..46660ab 100644
--- a/src/database/file/mod.rs
+++ b/src/database/file/mod.rs
@@ -254,6 +254,20 @@ async fn hydrate_author<S: Storage>(
 #[async_trait]
 impl Storage for FileStorage {
     #[tracing::instrument(skip(self))]
+    async fn categories(&self, url: &str) -> Result<Vec<String>> {
+        // This requires an expensive scan through the entire
+        // directory tree.
+        //
+        // Until this backend has some kind of caching/indexing for
+        // categories (consider using symlinks?), this query won't
+        // perform well.
+        Err(std::io::Error::new(
+            std::io::ErrorKind::Unsupported,
+            "?q=category queries are not implemented due to resource constraints"
+        ))?
+    }
+
+    #[tracing::instrument(skip(self))]
     async fn post_exists(&self, url: &str) -> Result<bool> {
         let path = url_to_path(&self.root_dir, url);
         debug!("Checking if {:?} exists...", path);