pub trait PersonalSessionRepository: Send + Sync {
type Error;
// Required methods
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<PersonalSession>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
owner: PersonalSessionOwner,
actor_user: &'life3 User,
human_name: String,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<PersonalSession, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn revoke<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
personal_session: PersonalSession,
) -> Pin<Box<dyn Future<Output = Result<PersonalSession, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: PersonalSessionFilter<'life1>,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<PersonalSession>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: PersonalSessionFilter<'life1>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
A PersonalSessionRepository
helps interacting with
PersonalSession
saved in the storage backend
Required Associated Types§
Required Methods§
Sourcefn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<PersonalSession>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<PersonalSession>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lookup a Personal session by its ID
Returns the Personal session if it exists, None
otherwise
§Parameters
id
: The ID of the Personal session to lookup
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
owner: PersonalSessionOwner,
actor_user: &'life3 User,
human_name: String,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<PersonalSession, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
owner: PersonalSessionOwner,
actor_user: &'life3 User,
human_name: String,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<PersonalSession, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Start a new Personal session
Returns the newly created Personal session
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampsowner_user
: The user that will own the personal sessionactor_user
: The user that will be represented by the personal sessiondevice
: The device ID of this sessionhuman_name
: The human-readable name of the session provided by the client or the userscope
: The [Scope
] of thePersonalSession
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn revoke<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
personal_session: PersonalSession,
) -> Pin<Box<dyn Future<Output = Result<PersonalSession, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn revoke<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
personal_session: PersonalSession,
) -> Pin<Box<dyn Future<Output = Result<PersonalSession, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
End a Personal session
Returns the ended Personal session
§Parameters
clock
: The clock used to generate timestampsPersonal_session
: The Personal session to end
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: PersonalSessionFilter<'life1>,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<PersonalSession>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: PersonalSessionFilter<'life1>,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<PersonalSession>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List PersonalSession
s matching the given filter and pagination
parameters
§Parameters
filter
: The filter parameterspagination
: The pagination parameters
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: PersonalSessionFilter<'life1>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: PersonalSessionFilter<'life1>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Count PersonalSession
s matching the given filter
§Parameters
filter
: The filter parameters
§Errors
Returns Self::Error
if the underlying repository fails