pub struct MaterializedViewCache { /* private fields */ }Expand description
Cache for materialized views
Implementations§
Source§impl MaterializedViewCache
impl MaterializedViewCache
Sourcepub fn register(&mut self, def: MaterializedViewDef)
pub fn register(&mut self, def: MaterializedViewDef)
Register a view definition
Sourcepub fn claim_due_at(&mut self, now: Instant) -> Vec<String>
pub fn claim_due_at(&mut self, now: Instant) -> Vec<String>
Atomically claim the set of views due for periodic refresh at
the given logical instant. Returned views have their
last_refresh pre-advanced to now so a concurrent caller on
the same tick sees them as not-due (the contract requested by
the “exactly once per tick, no duplicates” acceptance criterion
in issue #583 slice 10).
Sourcepub fn record_refresh_success(
&mut self,
name: &str,
data: Vec<u8>,
row_count: u64,
duration_ms: u64,
at_unix_ms: u64,
)
pub fn record_refresh_success( &mut self, name: &str, data: Vec<u8>, row_count: u64, duration_ms: u64, at_unix_ms: u64, )
Record a successful refresh — updates cached data, row count, duration, wall-clock timestamp, and clears any prior error.
Sourcepub fn record_refresh_failure(
&mut self,
name: &str,
error: String,
duration_ms: u64,
at_unix_ms: u64,
)
pub fn record_refresh_failure( &mut self, name: &str, error: String, duration_ms: u64, at_unix_ms: u64, )
Record a refresh failure — captures the error string and
duration but leaves data / current_row_count intact so
the prior content remains readable (per acceptance criterion).
Sourcepub fn metadata(&self) -> Vec<MaterializedViewMetadata>
pub fn metadata(&self) -> Vec<MaterializedViewMetadata>
Per-view runtime state snapshot — feeds red.materialized_views.
Sourcepub fn needs_refresh(&self, name: &str) -> bool
pub fn needs_refresh(&self, name: &str) -> bool
Check if view needs refresh
Sourcepub fn mark_stale(&mut self, table: &str)
pub fn mark_stale(&mut self, table: &str)
Mark views depending on a table as stale
Sourcepub fn due_for_refresh(&self) -> Vec<String>
pub fn due_for_refresh(&self) -> Vec<String>
Get views needing periodic refresh
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MaterializedViewCache
impl RefUnwindSafe for MaterializedViewCache
impl Send for MaterializedViewCache
impl Sync for MaterializedViewCache
impl Unpin for MaterializedViewCache
impl UnsafeUnpin for MaterializedViewCache
impl UnwindSafe for MaterializedViewCache
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request