pub trait SessionService: Send + Sync {
// Required methods
fn create<'life0, 'async_trait>(
&'life0 self,
req: CreateRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Session>, SessionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get<'life0, 'async_trait>(
&'life0 self,
req: GetRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Session>, SessionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
req: ListRequest,
) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<dyn Session>>, SessionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'async_trait>(
&'life0 self,
req: DeleteRequest,
) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn append_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 dyn Session,
event: &'life2 mut Event,
) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
A session storage service.
Required Methods§
Sourcefn create<'life0, 'async_trait>(
&'life0 self,
req: CreateRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Session>, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
&'life0 self,
req: CreateRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Session>, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates a session.
Sourcefn get<'life0, 'async_trait>(
&'life0 self,
req: GetRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Session>, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
req: GetRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Session>, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets a session; SessionError::NotFound if it does not exist (or belongs to
another user).
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
req: ListRequest,
) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<dyn Session>>, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
req: ListRequest,
) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<dyn Session>>, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists sessions; an empty result when there are none.
The sessions are ordered by last update time ascending, so the last session is the most
recently active one. Sessions with equal update times are ordered by user ID, then by
session ID (see compare_by_last_update).
Sourcefn delete<'life0, 'async_trait>(
&'life0 self,
req: DeleteRequest,
) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
req: DeleteRequest,
) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deletes a session; a no-op when it does not exist.
Sourcefn append_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 dyn Session,
event: &'life2 mut Event,
) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn append_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 dyn Session,
event: &'life2 mut Event,
) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Appends event to session and removes temporary state keys from it.
An event arriving with an empty ID must end up with one (assigned in place where the
implementation assigns it), and crate::EventActions::compaction must survive the
round trip. Returns SessionError::NotFound when the session is absent.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".