use crate::error::StorageError;
use crate::session::Session;
use crate::types::SessionId;
use async_trait::async_trait;
pub mod memory;
#[async_trait]
pub trait SessionStore: Send + Sync {
async fn create(&self, session: Session) -> Result<SessionId, StorageError>;
async fn get(&self, id: &SessionId) -> Result<Option<Session>, StorageError>;
async fn update(&self, id: &SessionId, session: Session) -> Result<(), StorageError>;
async fn delete(&self, id: &SessionId) -> Result<(), StorageError>;
async fn list(&self) -> Result<Vec<SessionId>, StorageError>;
async fn exists(&self, id: &SessionId) -> Result<bool, StorageError> {
Ok(self.get(id).await?.is_some())
}
}