pub struct ExecCancel { /* private fields */ }Expand description
Shared cancellation signal for one executing query.
Construct with ExecCancel::with_deadline (server path) or
ExecCancel::new (never auto-cancels; useful for explicit cancel only).
The async side keeps a clone and calls ExecCancel::cancel; the executor
thread reads it through the installed thread-local via CancelCheck.
Implementations§
Source§impl ExecCancel
impl ExecCancel
Sourcepub fn new() -> Self
pub fn new() -> Self
A token with no deadline. Only an explicit ExecCancel::cancel trips it.
Sourcepub fn with_deadline(deadline: Instant, timeout_ms: u64) -> Self
pub fn with_deadline(deadline: Instant, timeout_ms: u64) -> Self
A token that trips itself once deadline passes. timeout_ms is the
configured timeout used to render the timeout error message.
Sourcepub fn cancel(&self, reason: CancelReason)
pub fn cancel(&self, reason: CancelReason)
Explicitly cancel for reason. Idempotent; the first reason to win
stands. Safe to call from any thread.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the query should stop: explicitly cancelled, or past its deadline.
Sourcepub fn reason(&self) -> Option<CancelReason>
pub fn reason(&self) -> Option<CancelReason>
The cancellation reason, or None if the query may continue. An
explicit cancel wins; otherwise a passed deadline reports Timeout.