Trait carapax::session::backend::SessionBackend
source · pub trait SessionBackend {
type Error: Error + Send + Sync + 'static;
// Required methods
fn get_sessions(
&mut self
) -> impl Future<Output = Result<Vec<String>, Self::Error>> + Send;
fn get_session_age(
&mut self,
session_id: &str
) -> impl Future<Output = Result<Option<u64>, Self::Error>> + Send;
fn remove_session(
&mut self,
session_id: &str
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn read_value(
&mut self,
session_id: &str,
key: &str
) -> impl Future<Output = Result<Option<Vec<u8>>, Self::Error>> + Send;
fn write_value(
&mut self,
session_id: &str,
key: &str,
value: &[u8]
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn remove_value(
&mut self,
session_id: &str,
key: &str
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Available on crate feature
session
only.Expand description
A session backend interface
Required Associated Types§
Required Methods§
sourcefn get_sessions(
&mut self
) -> impl Future<Output = Result<Vec<String>, Self::Error>> + Send
fn get_sessions( &mut self ) -> impl Future<Output = Result<Vec<String>, Self::Error>> + Send
Returns a list of available session IDs
sourcefn get_session_age(
&mut self,
session_id: &str
) -> impl Future<Output = Result<Option<u64>, Self::Error>> + Send
fn get_session_age( &mut self, session_id: &str ) -> impl Future<Output = Result<Option<u64>, Self::Error>> + Send
Returns the time when session was created in seconds
This method MUST return session age if session exists and None otherwise
§Arguments
- session_id - ID of a session
sourcefn remove_session(
&mut self,
session_id: &str
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn remove_session( &mut self, session_id: &str ) -> impl Future<Output = Result<(), Self::Error>> + Send
sourcefn read_value(
&mut self,
session_id: &str,
key: &str
) -> impl Future<Output = Result<Option<Vec<u8>>, Self::Error>> + Send
fn read_value( &mut self, session_id: &str, key: &str ) -> impl Future<Output = Result<Option<Vec<u8>>, Self::Error>> + Send
Read a value from store
- session_id - ID of a session
- key - Key to read value from
Object Safety§
This trait is not object safe.