use std::future::Future; use serde_json::{Map, Value}; use super::SessionKey; use crate::error::AppError; pub type SessionState = Map; pub trait SessionStore { fn load( &self, session_key: &SessionKey, ) -> impl Future, AppError>>; fn save( &self, session_state: SessionState, ttl_secs: u64, ) -> impl Future>; fn update( &self, session_key: SessionKey, session_state: SessionState, ttl_secs: u64, ) -> impl Future>; fn update_ttl( &self, session_key: &SessionKey, ttl_secs: u64, ) -> impl Future>; fn delete(&self, session_key: &SessionKey) -> impl Future>; }