pub struct MaterializedViewManager { /* private fields */ }Expand description
Manager for materialized query result views
Thread-safe: all public methods acquire only short-lived locks.
Implementations§
Source§impl MaterializedViewManager
impl MaterializedViewManager
Sourcepub fn with_config(config: ViewManagerConfig) -> Self
pub fn with_config(config: ViewManagerConfig) -> Self
Create a new view manager with explicit configuration
Sourcepub fn new(max_views: usize, default_ttl: Duration) -> Self
pub fn new(max_views: usize, default_ttl: Duration) -> Self
Create a new view manager with default settings
Sourcepub fn store_view(
&self,
query_hash: &str,
pattern: &str,
results: Vec<BindingRow>,
dependent_predicates: Vec<String>,
) -> Result<()>
pub fn store_view( &self, query_hash: &str, pattern: &str, results: Vec<BindingRow>, dependent_predicates: Vec<String>, ) -> Result<()>
Store a new view.
If the cache is full, the least-recently-used view is evicted first. Large result sets (exceeding the memory row threshold) are spilled to disk.
Sourcepub fn get_view(&self, query_hash: &str) -> Option<Vec<BindingRow>>
pub fn get_view(&self, query_hash: &str) -> Option<Vec<BindingRow>>
Retrieve a view by query hash. Returns None on cache miss or if expired.
Sourcepub fn invalidate_by_predicate(&self, predicate_iri: &str) -> usize
pub fn invalidate_by_predicate(&self, predicate_iri: &str) -> usize
Invalidate all views that depend on a given predicate IRI.
Returns the number of views removed.
Sourcepub fn invalidate_pattern(&self, affected_pattern: &str) -> usize
pub fn invalidate_pattern(&self, affected_pattern: &str) -> usize
Invalidate views whose query pattern contains the given substring. Useful for invalidating based on graph pattern structure changes.
Sourcepub fn evict_expired(&self) -> usize
pub fn evict_expired(&self) -> usize
Remove all views whose TTL has elapsed.
Returns the number of expired views removed.
Sourcepub fn invalidate_view(&self, query_hash: &str) -> bool
pub fn invalidate_view(&self, query_hash: &str) -> bool
Explicitly remove a single view by hash
Sourcepub fn get_stats(&self) -> ViewManagerStats
pub fn get_stats(&self) -> ViewManagerStats
Retrieve current statistics snapshot
Auto Trait Implementations§
impl Freeze for MaterializedViewManager
impl RefUnwindSafe for MaterializedViewManager
impl Send for MaterializedViewManager
impl Sync for MaterializedViewManager
impl Unpin for MaterializedViewManager
impl UnsafeUnpin for MaterializedViewManager
impl UnwindSafe for MaterializedViewManager
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
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.