pub struct LocksService { /* private fields */ }Expand description
High-level lock service (NestJS LocksService analogue).
Implementations§
Source§impl LocksService
impl LocksService
pub fn from_options(opts: &LocksOptions) -> Self
pub async fn try_acquire(&self, name: &str) -> Option<LockGuard>
pub async fn with_lock<F, Fut, T>(&self, name: &str, f: F) -> Option<T>
Trait Implementations§
Source§impl Injectable for LocksService
impl Injectable for LocksService
fn construct(_registry: &ProviderRegistry) -> Arc<Self> ⓘ
Source§fn scope() -> ProviderScope
fn scope() -> ProviderScope
Provider scope used when the module registers this type.
fn on_module_init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn on_module_destroy<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn on_application_bootstrap<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Source§fn on_before_application_shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn on_before_application_shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
NestJS
beforeApplicationShutdown: fires before on_application_shutdown /
on_module_destroy during graceful shutdown. Use to flush caches, close
long-lived connections, or release resources while dependents are still alive.fn on_application_shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for LocksService
impl !UnwindSafe for LocksService
impl Forget for LocksService
impl Freeze for LocksService
impl Send for LocksService
impl Sync for LocksService
impl Unpin for LocksService
impl UnsafeUnpin for LocksService
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