pub struct ViewManager { /* private fields */ }Expand description
Manager for a collection of materialized views.
The manager owns all MaterializedView instances and handles delta propagation.
Implementations§
Source§impl ViewManager
impl ViewManager
Sourcepub fn register_view(
&mut self,
definition: ViewDefinition,
initial_rows: Vec<HashMap<String, String>>,
)
pub fn register_view( &mut self, definition: ViewDefinition, initial_rows: Vec<HashMap<String, String>>, )
Register a new view with its initial result rows.
If a view with the same id already exists it is replaced.
Sourcepub fn drop_view(&mut self, view_id: &str) -> bool
pub fn drop_view(&mut self, view_id: &str) -> bool
Remove a view by its ID.
Returns true if the view existed and was removed, false otherwise.
Sourcepub fn propagate_deltas(&mut self, deltas: &[TripleDelta]) -> Vec<String>
pub fn propagate_deltas(&mut self, deltas: &[TripleDelta]) -> Vec<String>
Propagate a batch of deltas to all registered views.
Views whose predicate sets overlap with the deltas are marked stale.
Returns the IDs of all views that were newly marked stale by this call.
Sourcepub fn get_view_data(&self, view_id: &str) -> Option<&[HashMap<String, String>]>
pub fn get_view_data(&self, view_id: &str) -> Option<&[HashMap<String, String>]>
Return the current rows of a view, or None if the view does not exist or is stale.
Sourcepub fn refresh_view(
&mut self,
view_id: &str,
new_rows: Vec<HashMap<String, String>>,
)
pub fn refresh_view( &mut self, view_id: &str, new_rows: Vec<HashMap<String, String>>, )
Refresh a stale view with freshly-computed result rows.
This clears the stale flag so the view is immediately queryable again. Does nothing if the view does not exist.
Sourcepub fn stale_views(&self) -> Vec<&str>
pub fn stale_views(&self) -> Vec<&str>
Return the IDs of all currently stale views.
Sourcepub fn view_count(&self) -> usize
pub fn view_count(&self) -> usize
Return the total number of registered views.
Sourcepub fn get_view(&self, view_id: &str) -> Option<&MaterializedView>
pub fn get_view(&self, view_id: &str) -> Option<&MaterializedView>
Return a reference to a view, regardless of stale status.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ViewManager
impl RefUnwindSafe for ViewManager
impl Send for ViewManager
impl Sync for ViewManager
impl Unpin for ViewManager
impl UnsafeUnpin for ViewManager
impl UnwindSafe for ViewManager
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 more