Skip to main content

Module cancel

Module cancel 

Source
Expand description

Cooperative query cancellation token.

Issue #808 / PRD #750 (750d) — the propagation primitive for query cancellation. A CancelToken is a cheap, cloneable handle over a shared atomic flag. The streaming / cursor layer owns one token per live stream; the executor’s pull-based iterators (super::iterator) observe it between rows so a cancel raised by a client disconnect or an explicit cancel request stops scans, filters, joins, and the aggregates that consume them promptly, rather than after the whole result has been materialised.

The token carries no reason of its own — the wire-visible reason lives at the native server’s stream layer (output_stream::CloseReason). Here it is a single boolean: “should this query stop now?”. Cooperative by design: an operator that never re-checks the token cannot be interrupted, so every long-running loop in the executor must poll CancelToken::is_cancelled on each iteration.

Structs§

CancelToken
A cloneable handle over a shared cancellation flag.