pub trait SessionBackend:
Send
+ Sync
+ 'static {
// Required methods
fn load(
&self,
id: String,
now: u64,
refresh_expires_at: u64,
) -> BoxFuture<Result<Option<SessionSnapshot>, SessionBackendError>>;
fn create(
&self,
id: String,
values: HashMap<String, Value>,
expires_at: u64,
) -> BoxFuture<Result<SessionWrite, SessionBackendError>>;
fn save(
&self,
id: String,
expected_version: u64,
values: HashMap<String, Value>,
expires_at: u64,
) -> BoxFuture<Result<SessionWrite, SessionBackendError>>;
fn rotate(
&self,
old_id: String,
new_id: String,
expected_version: u64,
values: HashMap<String, Value>,
expires_at: u64,
) -> BoxFuture<Result<SessionWrite, SessionBackendError>>;
fn delete(
&self,
id: String,
expected_version: u64,
) -> BoxFuture<Result<SessionWrite, SessionBackendError>>;
}Expand description
Distributed session contract.
Implementations must make each mutation atomic and enforce the supplied version.
Required Methods§
fn load( &self, id: String, now: u64, refresh_expires_at: u64, ) -> BoxFuture<Result<Option<SessionSnapshot>, SessionBackendError>>
fn create( &self, id: String, values: HashMap<String, Value>, expires_at: u64, ) -> BoxFuture<Result<SessionWrite, SessionBackendError>>
fn save( &self, id: String, expected_version: u64, values: HashMap<String, Value>, expires_at: u64, ) -> BoxFuture<Result<SessionWrite, SessionBackendError>>
fn rotate( &self, old_id: String, new_id: String, expected_version: u64, values: HashMap<String, Value>, expires_at: u64, ) -> BoxFuture<Result<SessionWrite, SessionBackendError>>
fn delete( &self, id: String, expected_version: u64, ) -> BoxFuture<Result<SessionWrite, SessionBackendError>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".