pub struct AfterHookQueue<S: AuthSchema>(/* private fields */);Expand description
After-hooks recorded by writes inside an auth transaction.
Rollback drops the queue. After commit, run replays every
event in operation order, invoking each registered hook per event; a hook
error is returned to the caller after the auth writes have committed.
Implementations§
Source§impl<S: AuthSchema> AfterHookQueue<S>
impl<S: AuthSchema> AfterHookQueue<S>
pub const fn new() -> Self
pub async fn push(&self, event: AfterHook<S>)
Sourcepub async fn run<B: HookBackend>(
self,
hooks: &[Arc<dyn DatabaseHooks<S, B>>],
ctx: &DatabaseHookContext<'_, B>,
) -> AuthResult<()>
pub async fn run<B: HookBackend>( self, hooks: &[Arc<dyn DatabaseHooks<S, B>>], ctx: &DatabaseHookContext<'_, B>, ) -> AuthResult<()>
Sourcepub async fn run_with_policy<B: HookBackend>(
self,
hooks: &[Arc<dyn DatabaseHooks<S, B>>],
ctx: &DatabaseHookContext<'_, B>,
policy: AfterCommitErrorPolicy,
) -> AuthResult<()>
pub async fn run_with_policy<B: HookBackend>( self, hooks: &[Arc<dyn DatabaseHooks<S, B>>], ctx: &DatabaseHookContext<'_, B>, policy: AfterCommitErrorPolicy, ) -> AuthResult<()>
Run queued hooks, optionally reporting errors after durable commit.
§Errors
Returns hook errors when propagation is selected.
Trait Implementations§
Source§impl<S: AuthSchema> Default for AfterHookQueue<S>
impl<S: AuthSchema> Default for AfterHookQueue<S>
Auto Trait Implementations§
impl<S> !Freeze for AfterHookQueue<S>
impl<S> !RefUnwindSafe for AfterHookQueue<S>
impl<S> !UnwindSafe for AfterHookQueue<S>
impl<S> Send for AfterHookQueue<S>
impl<S> Sync for AfterHookQueue<S>
impl<S> Unpin for AfterHookQueue<S>
impl<S> UnsafeUnpin for AfterHookQueue<S>
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