Expand description
Query cancellation support.
A CancellationToken is a cheap-to-clone, thread-safe one-shot
flag stored on Engine and propagated into every
PhysicalOperator / Operator hot loop. Operators call
CancellationToken::check at chunk boundaries; if the flag has
been set from another thread, check returns
QueryCancelled which surfaces to the SQL layer as
PostgreSQL SQLSTATE 57014 (query_canceled).
use uqa_core::cancel::{CancellationToken, QueryCancelled};
let tok = CancellationToken::new();
let probe = tok.clone();
tok.cancel();
assert!(probe.is_cancelled());
assert!(matches!(probe.check(), Err(QueryCancelled)));The token is a Clone-by-Arc handle: every clone speaks to the
same underlying flag, so issuing engine.cancel() from one thread
is immediately visible to any operator that received a clone of
the token before the cancellation.
Structs§
- Cancellation
Token - Thread-safe cancellation token for query execution.
- Query
Cancelled - Raised when a query is cancelled by user request. Matches
PostgreSQLSQLSTATE 57014(query_canceled); itsDisplaypayload stays stable for log processing.
Constants§
- SQLSTATE_
QUERY_ CANCELED PostgreSQLSQLSTATE forQueryCancelled.