about summary refs log tree commit diff
path: root/kittybox-rs/src/database/mod.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-06-22 20:28:21 +0300
committerVika <vika@fireburn.ru>2023-06-22 20:28:21 +0300
commitd61e1f6a8e5ad5b7c14b1f9ab3101496f3f9ea00 (patch)
treea8db5c905061fd25b19825a4d8aee890dd7c62b2 /kittybox-rs/src/database/mod.rs
parentff358723da641af9f4ae1f742eb1b382f4630220 (diff)
downloadkittybox-d61e1f6a8e5ad5b7c14b1f9ab3101496f3f9ea00.tar.zst
database: introduce read_feed_with_cursor
read_feed_with_cursor allows using an arbitrary string as a cursor,
unlike read_feed_with_limit, which uses last post's UID as a cursor.
Diffstat (limited to 'kittybox-rs/src/database/mod.rs')
-rw-r--r--kittybox-rs/src/database/mod.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/kittybox-rs/src/database/mod.rs b/kittybox-rs/src/database/mod.rs
index ea4205c..4b1b348 100644
--- a/kittybox-rs/src/database/mod.rs
+++ b/kittybox-rs/src/database/mod.rs
@@ -330,6 +330,14 @@ pub trait Storage: std::fmt::Debug + Clone + Send + Sync {
         user: &'_ Option<String>,
     ) -> Result<Option<serde_json::Value>>;
 
+    async fn read_feed_with_cursor(
+        &self,
+        url: &'_ str,
+        cursor: Option<&'_ str>,
+        limit: usize,
+        user: Option<&'_ str>
+    ) -> Result<Option<(serde_json::Value, Option<String>)>>;
+
     /// Deletes a post from the database irreversibly. 'nuff said. Must be idempotent.
     async fn delete_post(&self, url: &'_ str) -> Result<()>;
 
@@ -337,7 +345,7 @@ pub trait Storage: std::fmt::Debug + Clone + Send + Sync {
     async fn get_setting<S: Setting<'a>, 'a>(&'_ self, user: &'_ str) -> Result<S>;
 
     /// Commits a setting to the setting store.
-    async fn set_setting<S: Setting<'a>, 'a>(&self, user: &'_ str, value: S::Data) -> Result<()>;
+    async fn set_setting<S: Setting<'a> + 'a, 'a>(&self, user: &'a str, value: S::Data) -> Result<()>;
 }
 
 #[cfg(test)]