Skip to main content

Module cancel

Module cancel 

Source
Expand description

Lightweight cancellation token for long-running search operations.

CancellationToken is an Arc<AtomicBool> wrapper. The cancel() call sets the flag; the background task polls is_cancelled() between pages and exits early when the flag is set.

This deliberately avoids tokio_util::sync::CancellationToken to keep the dependency surface small — the atomics-based approach is sufficient for a single-flag stop signal.

OCP: wrapping the Arc<AtomicBool> in this struct means the token shape can be extended (e.g. adding a reason code) without changing call sites.

Structs§

CancellationToken
A cloneable, thread-safe cancellation flag.