Skip to main content

uqa_engine/
cancellation.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7use super::Engine;
8
9impl Engine {
10    pub fn cancel(&self) {
11        self.runtime.cancellation.cancel();
12    }
13
14    /// Reset the cancellation flag so subsequent queries run
15    /// normally. Call between query batches when reusing the same
16    /// engine for many cancellable executions.
17    pub fn reset_cancellation(&self) {
18        self.runtime.cancellation.reset();
19    }
20
21    pub fn cancellation_token(&self) -> uqa_core::CancellationToken {
22        self.query_runtime_view().cancellation_token()
23    }
24
25    /// compatibility alias for [`Engine::cancellation_token`].
26    pub fn cancel_token(&self) -> uqa_core::CancellationToken {
27        self.cancellation_token()
28    }
29
30    pub fn is_cancelled(&self) -> bool {
31        self.runtime.cancellation.is_cancelled()
32    }
33}