feat: pass cancellation token to interpreter
This commit is contained in:
parent
f5d45f6a1d
commit
eeb34a51ce
5 changed files with 45 additions and 13 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
use minisql::cancellation::Cancellation;
|
||||
|
||||
pub struct ResetCancelToken {
|
||||
is_canceled: Arc<AtomicBool>,
|
||||
|
|
@ -12,10 +13,6 @@ impl ResetCancelToken {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_canceled(&self) -> bool {
|
||||
self.is_canceled.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
pub fn cancel(&self) {
|
||||
self.is_canceled.store(true, Ordering::SeqCst);
|
||||
}
|
||||
|
|
@ -25,6 +22,12 @@ impl ResetCancelToken {
|
|||
}
|
||||
}
|
||||
|
||||
impl Cancellation for ResetCancelToken {
|
||||
fn is_canceled(&self) -> bool {
|
||||
self.is_canceled.load(Ordering::SeqCst)
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for ResetCancelToken {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,6 @@ where
|
|||
parse_and_validate(query, &db_schema)?
|
||||
};
|
||||
|
||||
// TODO: PASS DOWN RESET CANCEL TOKEN
|
||||
state.interpret(writer, operation).await?;
|
||||
state.interpret(writer, token, operation).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue