pub struct ChangeFeed { /* private fields */ }Expand description
Ordered stream of committed ChangeBatches from one database.
Poll it with Self::poll (non-blocking) or Self::next_timeout.
Dropping the feed unsubscribes it.
Implementations§
Source§impl ChangeFeed
impl ChangeFeed
Sourcepub fn last_lsn(&self) -> Option<u64>
pub fn last_lsn(&self) -> Option<u64>
LSN of the last batch this feed delivered (or the from_lsn it was
opened with). Pass it as from_lsn to resume.
Sourcepub fn closer(&self) -> ChangeFeedCloser
pub fn closer(&self) -> ChangeFeedCloser
Handle for closing this feed from another thread.
Sourcepub fn close(&self)
pub fn close(&self)
Close the feed. Later polls return ChangePoll::Closed.
Sourcepub fn set_waker(&self, waker: impl Fn() + Send + Sync + 'static)
pub fn set_waker(&self, waker: impl Fn() + Send + Sync + 'static)
Install a callback that fires when the feed goes from empty to non-empty, lags, or closes. It runs on the writing thread while the writer lock is held, so it must be quick and must not call back into the database.
Sourcepub fn poll(&mut self) -> Result<ChangePoll, LoraError>
pub fn poll(&mut self) -> Result<ChangePoll, LoraError>
Next batch without blocking. History replay (resuming from an LSN older than the in-memory window) does its work inside this call.
Fails with LORA_CHANGES_LAGGED once the feed has fallen behind and
its buffered batches are drained; the feed is closed afterwards.
Sourcepub fn next_timeout(
&mut self,
timeout: Duration,
) -> Result<ChangePoll, LoraError>
pub fn next_timeout( &mut self, timeout: Duration, ) -> Result<ChangePoll, LoraError>
Block until a batch arrives, the feed closes, or timeout passes
(then ChangePoll::Pending).
Trait Implementations§
Source§impl Drop for ChangeFeed
impl Drop for ChangeFeed
Auto Trait Implementations§
impl !RefUnwindSafe for ChangeFeed
impl !UnwindSafe for ChangeFeed
impl Freeze for ChangeFeed
impl Send for ChangeFeed
impl Sync for ChangeFeed
impl Unpin for ChangeFeed
impl UnsafeUnpin for ChangeFeed
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