pub struct ReconfigurableLiveQuery<Request, Value> { /* private fields */ }Expand description
A tracked query whose absolute request can change without replacing the subscription.
Construct one with
CovenHandle::subscribe_reconfigurable.
Request changes and relevant commits are coalesced before each run. If the
request changes while a run is in progress, that result is discarded and
the latest request is evaluated before an event is returned.
A run caused only by committed changes whose value equals the last
delivered value is not delivered: the query’s read dependencies are
table-and-key granular, so a paged query (ORDER BY … LIMIT) reruns for any
row change in its tables, and most of those reruns leave its window
unchanged. The initial run, a run after a request change, and every error
are always delivered; the first successful value after an error is too.
Implementations§
Source§impl<Request, Value> ReconfigurableLiveQuery<Request, Value>
impl<Request, Value> ReconfigurableLiveQuery<Request, Value>
Sourcepub fn process<P, R>(self, process: P) -> ReconfigurableLiveQuery<Request, R>
pub fn process<P, R>(self, process: P) -> ReconfigurableLiveQuery<Request, R>
Process each fetched value on bounded workers after releasing its read connection. Dependencies and request revisions stay attached to the read; only processed values are compared when deciding whether to deliver.
The returned subscription starts with an initial result for the latest request, even if this subscription previously delivered values. Existing request handles continue to control it.
Sourcepub fn requests(&self) -> LiveQueryRequests<Request>
pub fn requests(&self) -> LiveQueryRequests<Request>
Return a handle that can replace this subscription’s absolute request.
Sourcepub async fn next(&mut self) -> ReconfigurableLiveQueryEvent<Request, Value>
pub async fn next(&mut self) -> ReconfigurableLiveQueryEvent<Request, Value>
Return the initial event, or wait for a request change or relevant committed database change and return the next event.
Query errors are events and do not end the subscription. Cancelling the future preserves the pending request or database change. A commit-caused rerun whose value equals the last delivered value is not an event; the query goes back to waiting.
Auto Trait Implementations§
impl<Request, Value> Freeze for ReconfigurableLiveQuery<Request, Value>
impl<Request, Value> !RefUnwindSafe for ReconfigurableLiveQuery<Request, Value>
impl<Request, Value> Send for ReconfigurableLiveQuery<Request, Value>
impl<Request, Value> Sync for ReconfigurableLiveQuery<Request, Value>
impl<Request, Value> Unpin for ReconfigurableLiveQuery<Request, Value>
impl<Request, Value> UnsafeUnpin for ReconfigurableLiveQuery<Request, Value>where
Request: UnsafeUnpin,
Value: UnsafeUnpin,
impl<Request, Value> !UnwindSafe for ReconfigurableLiveQuery<Request, Value>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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