You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-11-21 23:00:50 +03:00
Schedule jobs through the repository
This commit is contained in:
@@ -20,6 +20,7 @@ use crate::{
|
||||
CompatAccessTokenRepository, CompatRefreshTokenRepository, CompatSessionRepository,
|
||||
CompatSsoLoginRepository,
|
||||
},
|
||||
job::JobRepository,
|
||||
oauth2::{
|
||||
OAuth2AccessTokenRepository, OAuth2AuthorizationGrantRepository, OAuth2ClientRepository,
|
||||
OAuth2RefreshTokenRepository, OAuth2SessionRepository,
|
||||
@@ -192,6 +193,9 @@ pub trait RepositoryAccess: Send {
|
||||
fn compat_refresh_token<'c>(
|
||||
&'c mut self,
|
||||
) -> Box<dyn CompatRefreshTokenRepository<Error = Self::Error> + 'c>;
|
||||
|
||||
/// Get a [`JobRepository`]
|
||||
fn job<'c>(&'c mut self) -> Box<dyn JobRepository<Error = Self::Error> + 'c>;
|
||||
}
|
||||
|
||||
/// Implementations of the [`RepositoryAccess`], [`RepositoryTransaction`] and
|
||||
@@ -205,6 +209,7 @@ mod impls {
|
||||
CompatAccessTokenRepository, CompatRefreshTokenRepository, CompatSessionRepository,
|
||||
CompatSsoLoginRepository,
|
||||
},
|
||||
job::JobRepository,
|
||||
oauth2::{
|
||||
OAuth2AccessTokenRepository, OAuth2AuthorizationGrantRepository,
|
||||
OAuth2ClientRepository, OAuth2RefreshTokenRepository, OAuth2SessionRepository,
|
||||
@@ -373,6 +378,10 @@ mod impls {
|
||||
&mut self.mapper,
|
||||
))
|
||||
}
|
||||
|
||||
fn job<'c>(&'c mut self) -> Box<dyn JobRepository<Error = Self::Error> + 'c> {
|
||||
Box::new(MapErr::new(self.inner.job(), &mut self.mapper))
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: RepositoryAccess + ?Sized> RepositoryAccess for Box<R> {
|
||||
@@ -469,5 +478,9 @@ mod impls {
|
||||
) -> Box<dyn CompatRefreshTokenRepository<Error = Self::Error> + 'c> {
|
||||
(**self).compat_refresh_token()
|
||||
}
|
||||
|
||||
fn job<'c>(&'c mut self) -> Box<dyn JobRepository<Error = Self::Error> + 'c> {
|
||||
(**self).job()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user