diff options
Diffstat (limited to 'kittybox-rs/src/database')
-rw-r--r-- | kittybox-rs/src/database/file/mod.rs | 12 | ||||
-rw-r--r-- | kittybox-rs/src/database/memory.rs | 13 | ||||
-rw-r--r-- | kittybox-rs/src/database/mod.rs | 10 |
3 files changed, 32 insertions, 3 deletions
diff --git a/kittybox-rs/src/database/file/mod.rs b/kittybox-rs/src/database/file/mod.rs index 531f7b1..a9de63e 100644 --- a/kittybox-rs/src/database/file/mod.rs +++ b/kittybox-rs/src/database/file/mod.rs @@ -499,6 +499,16 @@ impl Storage for FileStorage { } } + async fn read_feed_with_cursor( + &self, + url: &'_ str, + cursor: Option<&'_ str>, + limit: usize, + user: Option<&'_ str> + ) -> Result<Option<(serde_json::Value, Option<String>)>> { + todo!() + } + #[tracing::instrument(skip(self))] async fn read_feed_with_limit( &self, @@ -605,7 +615,7 @@ impl Storage for FileStorage { } #[tracing::instrument(skip(self))] - async fn set_setting<S: settings::Setting<'a>, 'a>(&self, user: &'_ str, value: S::Data) -> Result<()> { + async fn set_setting<S: settings::Setting<'a> + 'a, 'a>(&self, user: &'a str, value: S::Data) -> Result<()> { let url = axum::http::Uri::try_from(user).expect("Couldn't parse a URL"); let mut path = relative_path::RelativePathBuf::new(); path.push(url.authority().unwrap().to_string()); diff --git a/kittybox-rs/src/database/memory.rs b/kittybox-rs/src/database/memory.rs index 9d79ecc..36e924f 100644 --- a/kittybox-rs/src/database/memory.rs +++ b/kittybox-rs/src/database/memory.rs @@ -238,6 +238,17 @@ impl Storage for MemoryStorage { todo!() } + #[allow(unused_variables)] + async fn read_feed_with_cursor( + &self, + url: &'_ str, + cursor: Option<&'_ str>, + limit: usize, + user: Option<&'_ str> + ) -> Result<Option<(serde_json::Value, Option<String>)>> { + todo!() + } + async fn delete_post(&self, url: &'_ str) -> Result<()> { self.mapping.write().await.remove(url); Ok(()) @@ -249,7 +260,7 @@ impl Storage for MemoryStorage { } #[allow(unused_variables)] - async fn set_setting<S: settings::Setting<'a>, 'a>(&self, user: &'_ str, value: S::Data) -> Result<()> { + async fn set_setting<S: settings::Setting<'a> + 'a, 'a>(&self, user: &'a str, value: S::Data) -> Result<()> { todo!() } 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)] |