pub struct FrameworkTenantScopeProvider { /* private fields */ }Expand description
Framework implementation of ferro-queue’s TenantScopeProvider.
Uses TenantLookup::find_by_id() to restore full TenantContext from the tenant_id stored in the job payload, then wraps job execution in a task-local tenant scope so current_tenant() works inside job handlers.
Implementations§
Source§impl FrameworkTenantScopeProvider
impl FrameworkTenantScopeProvider
Sourcepub fn new(lookup: Arc<dyn TenantLookup>) -> Self
pub fn new(lookup: Arc<dyn TenantLookup>) -> Self
Create a new provider backed by the given TenantLookup.
Trait Implementations§
Source§impl TenantScopeProvider for FrameworkTenantScopeProvider
impl TenantScopeProvider for FrameworkTenantScopeProvider
Source§fn with_scope<'life0, 'async_trait>(
&'life0 self,
tenant_id: i64,
f: Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send>>,
) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn with_scope<'life0, 'async_trait>(
&'life0 self,
tenant_id: i64,
f: Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send>>,
) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run the given future within a tenant scope for the specified tenant.
Auto Trait Implementations§
impl Freeze for FrameworkTenantScopeProvider
impl !RefUnwindSafe for FrameworkTenantScopeProvider
impl Send for FrameworkTenantScopeProvider
impl Sync for FrameworkTenantScopeProvider
impl Unpin for FrameworkTenantScopeProvider
impl UnsafeUnpin for FrameworkTenantScopeProvider
impl !UnwindSafe for FrameworkTenantScopeProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more