pub struct ResultsState {
pub current_results: Option<QueryResponse>,
pub results_cache: HashMap<String, CachedResult>,
pub max_cache_size: usize,
pub total_memory_usage: usize,
pub memory_limit: usize,
pub last_query: String,
pub last_execution_time: Duration,
pub query_performance_history: VecDeque<QueryPerformance>,
pub from_cache: bool,
pub last_modified: Instant,
}
Expand description
Centralized query results state management
Fields§
§current_results: Option<QueryResponse>
Current query results for active buffer
results_cache: HashMap<String, CachedResult>
Results cache with LRU behavior
max_cache_size: usize
Maximum cache size (number of queries)
total_memory_usage: usize
Memory usage tracking
memory_limit: usize
Memory limit in bytes
last_query: String
Last query executed
last_execution_time: Duration
Last query execution time
query_performance_history: VecDeque<QueryPerformance>
Query history for performance analysis
from_cache: bool
Whether results are from cache
last_modified: Instant
Last modification timestamp
Implementations§
Source§impl ResultsState
impl ResultsState
pub fn new() -> Self
Sourcepub fn set_results(
&mut self,
results: QueryResponse,
execution_time: Duration,
from_cache: bool,
) -> Result<()>
pub fn set_results( &mut self, results: QueryResponse, execution_time: Duration, from_cache: bool, ) -> Result<()>
Set current query results with performance tracking
Sourcepub fn get_results(&self) -> Option<&QueryResponse>
pub fn get_results(&self) -> Option<&QueryResponse>
Get current results
Sourcepub fn cache_results(
&mut self,
query_key: String,
results: QueryResponse,
) -> Result<()>
pub fn cache_results( &mut self, query_key: String, results: QueryResponse, ) -> Result<()>
Cache query results with LRU management
Sourcepub fn get_cached_results(&mut self, query_key: &str) -> Option<&QueryResponse>
pub fn get_cached_results(&mut self, query_key: &str) -> Option<&QueryResponse>
Get cached results
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear all cached results
Sourcepub fn get_cache_stats(&self) -> CacheStats
pub fn get_cache_stats(&self) -> CacheStats
Get cache statistics
Sourcepub fn get_performance_stats(&self) -> PerformanceStats
pub fn get_performance_stats(&self) -> PerformanceStats
Get performance statistics
Trait Implementations§
Source§impl Clone for ResultsState
impl Clone for ResultsState
Source§fn clone(&self) -> ResultsState
fn clone(&self) -> ResultsState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ResultsState
impl Debug for ResultsState
Auto Trait Implementations§
impl Freeze for ResultsState
impl RefUnwindSafe for ResultsState
impl Send for ResultsState
impl Sync for ResultsState
impl Unpin for ResultsState
impl UnwindSafe for ResultsState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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