pub struct BatchOp<'inv> { /* private fields */ }Expand description
An op joined to the pending batch. Implements
AtomicOperation — use it exactly like any
atomic operation, then exit with commit or
defer.
There is no mutable access to the raw es_entity::DbOp (only a shared
Deref view): committing, rolling back, or swapping
out the underlying op is unrepresentable, so work and checkpoint can only
land together, through the runner.
Implementations§
Trait Implementations§
Source§impl AtomicOperation for BatchOp<'_>
Full delegation to the inner es_entity::DbOp — including the provided
methods, which es_entity::DbOp overrides (supports_hooks is true,
commit_hook returns registered hooks, maybe_now/clock carry the op’s
cached time and clock). Inheriting the trait defaults instead would
silently report supports_hooks() == false and lose the op time.
impl AtomicOperation for BatchOp<'_>
Full delegation to the inner es_entity::DbOp — including the provided
methods, which es_entity::DbOp overrides (supports_hooks is true,
commit_hook returns registered hooks, maybe_now/clock carry the op’s
cached time and clock). Inheriting the trait defaults instead would
silently report supports_hooks() == false and lose the op time.
This lets handlers pass &mut op directly to any
fn(&mut impl AtomicOperation) API (service *_in_op methods,
spawn_in_op, publish_persisted_in_op, …) — and it is the only
mutable surface: with no DerefMut, a &mut es_entity::DbOp can never be
obtained from the guard (which would allow std::mem::swap-ing in a decoy
op and committing the real one without its checkpoint).
Source§fn maybe_now(&self) -> Option<DateTime<Utc>>
fn maybe_now(&self) -> Option<DateTime<Utc>>
Source§fn clock(&self) -> &ClockHandle
fn clock(&self) -> &ClockHandle
Source§fn connection(&mut self) -> &mut Connection
fn connection(&mut self) -> &mut Connection
Source§fn as_executor(&mut self) -> OneTimeExecutor<'_, &mut Connection>
fn as_executor(&mut self) -> OneTimeExecutor<'_, &mut Connection>
sqlx::Executor implementation that statements should be
executed through. Read moreSource§fn add_commit_hook<H: CommitHook>(&mut self, hook: H) -> Result<(), H>
fn add_commit_hook<H: CommitHook>(&mut self, hook: H) -> Result<(), H>
Source§fn commit_hook<H: CommitHook>(&self) -> Option<&H>
fn commit_hook<H: CommitHook>(&self) -> Option<&H>
H,
if this operation supports commit hooks and one is registered.
Returns the hook a subsequent add_commit_hook::<H> call would merge into.Source§fn supports_hooks(&self) -> bool
fn supports_hooks(&self) -> bool
Auto Trait Implementations§
impl<'inv> !RefUnwindSafe for BatchOp<'inv>
impl<'inv> !Sync for BatchOp<'inv>
impl<'inv> !UnwindSafe for BatchOp<'inv>
impl<'inv> Freeze for BatchOp<'inv>
impl<'inv> Send for BatchOp<'inv>
impl<'inv> Unpin for BatchOp<'inv>
impl<'inv> UnsafeUnpin for BatchOp<'inv>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> ⓘ
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> ⓘ
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