pub struct QueryMonitor { /* private fields */ }Expand description
Query monitor for timeout enforcement and slow query logging
Implementations§
Source§impl QueryMonitor
impl QueryMonitor
Sourcepub fn new(config: QueryMonitorConfig) -> Self
pub fn new(config: QueryMonitorConfig) -> Self
Create a new query monitor
Sourcepub fn begin_query(
&self,
subject: Option<&Term>,
predicate: Option<&Term>,
object: Option<&Term>,
timeout_override: Option<Duration>,
) -> Arc<QueryExecution> ⓘ
pub fn begin_query( &self, subject: Option<&Term>, predicate: Option<&Term>, object: Option<&Term>, timeout_override: Option<Duration>, ) -> Arc<QueryExecution> ⓘ
Begin a monitored query execution
Sourcepub fn end_query(
&self,
execution: Arc<QueryExecution>,
result_count: usize,
) -> Result<()>
pub fn end_query( &self, execution: Arc<QueryExecution>, result_count: usize, ) -> Result<()>
End a monitored query execution
Sourcepub fn check_timeout(&self, execution: &Arc<QueryExecution>) -> Result<()>
pub fn check_timeout(&self, execution: &Arc<QueryExecution>) -> Result<()>
Check if a query should be cancelled due to timeout
Sourcepub fn slow_query_history(&self) -> Vec<SlowQueryRecord>
pub fn slow_query_history(&self) -> Vec<SlowQueryRecord>
Get slow query history
Sourcepub fn active_queries(&self) -> Vec<Arc<QueryExecution>>
pub fn active_queries(&self) -> Vec<Arc<QueryExecution>>
Get currently active queries
Sourcepub fn stats(&self) -> &QueryMonitorStats
pub fn stats(&self) -> &QueryMonitorStats
Get statistics
Sourcepub fn clear_slow_query_history(&self)
pub fn clear_slow_query_history(&self)
Clear slow query history
Sourcepub fn active_query_count(&self) -> usize
pub fn active_query_count(&self) -> usize
Get number of active queries
Sourcepub fn cancel_all(&self)
pub fn cancel_all(&self)
Cancel all running queries (emergency stop)
Auto Trait Implementations§
impl !Freeze for QueryMonitor
impl !RefUnwindSafe for QueryMonitor
impl !UnwindSafe for QueryMonitor
impl Send for QueryMonitor
impl Sync for QueryMonitor
impl Unpin for QueryMonitor
impl UnsafeUnpin for QueryMonitor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more