use crate::Error; use async_trait::async_trait; use chrono::NaiveDateTime; pub struct Subscription { pub id: String, pub topic: String, pub expiration: NaiveDateTime, pub push_resource: String, pub public_key: String, pub public_key_type: String, pub auth_secret: String, } #[async_trait] pub trait SubscriptionStore: Send + Sync + 'static { async fn get_subscriptions(&self, topic: &str) -> Result, Error>; async fn get_subscription(&self, id: &str) -> Result; /// Returns whether a subscription under the id already existed async fn upsert_subscription(&self, sub: Subscription) -> Result; async fn delete_subscription(&self, id: &str) -> Result<(), Error>; }