pub struct ExecutionCancellation { /* private fields */ }Expand description
Shared cooperative cancellation token for native query execution.
Cancellation is observed only at native-engine boundaries. It does not
preempt a libcudf/CUDA call already in flight, but it prevents the next
source chunk, pipeline task, operator, or materialization step from starting
once it is requested. A wait can also resolve on it through
Self::cancelled_or_expired.
Implementations§
Source§impl ExecutionCancellation
impl ExecutionCancellation
Sourcepub fn with_deadline(deadline: Option<Instant>) -> Self
pub fn with_deadline(deadline: Option<Instant>) -> Self
Creates a cancellation token with an optional absolute deadline.
The deadline is checked at the same cooperative native-engine boundaries as caller cancellation. It cannot preempt a CUDA call already in flight, but it prevents the next safe boundary from starting more native work after the deadline has elapsed.
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Marks the execution as cancelled and wakes every
Self::cancelled_or_expired waiter.
Sourcepub async fn cancelled_or_expired(&self)
pub async fn cancelled_or_expired(&self)
Resolves once the execution is cancelled or its deadline elapses, so a
wait with no other wakeup for either can race it. Self::check
still tells the two apart. Must run inside a Tokio runtime with the
time driver enabled when a deadline is set.
Sourcepub async fn terminated(&self, operation: &'static str) -> QueryError
pub async fn terminated(&self, operation: &'static str) -> QueryError
Resolves to the typed error that ends a wait: the cancellation, or the deadline once it elapses. A waiter returns it directly and does not read the clock again, since a paused Tokio clock can disagree with a fresh reading.
Sourcepub fn sleep(&self, duration: Duration, operation: &'static str) -> Result<()>
pub fn sleep(&self, duration: Duration, operation: &'static str) -> Result<()>
Blocks the calling thread for duration. Cancellation or an elapsed
deadline ends the wait early with the typed error Self::check
reports.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns whether this execution must stop at its next cooperative safe boundary.
An elapsed deadline is intentionally an effective cancellation here.
Callers that need to distinguish an explicit caller action from expiry
must use Self::check, which preserves explicit cancellation as the
primary reason.
Sourcepub fn deadline(&self) -> Option<Instant>
pub fn deadline(&self) -> Option<Instant>
Returns the optional absolute deadline shared by every clone.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns whether the optional deadline has elapsed.
Trait Implementations§
Source§impl Clone for ExecutionCancellation
impl Clone for ExecutionCancellation
Source§impl Debug for ExecutionCancellation
impl Debug for ExecutionCancellation
Auto Trait Implementations§
impl Freeze for ExecutionCancellation
impl RefUnwindSafe for ExecutionCancellation
impl Send for ExecutionCancellation
impl Sync for ExecutionCancellation
impl Unpin for ExecutionCancellation
impl UnsafeUnpin for ExecutionCancellation
impl UnwindSafe for ExecutionCancellation
Blanket Implementations§
impl<T> Allocation for T
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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