Struct mz_persist_client::read::Subscribe
source · pub struct Subscribe<K: Codec, V: Codec, T, D> {
snapshot: Option<Vec<LeasedBatchPart<T>>>,
listen: Listen<K, V, T, D>,
}
Expand description
Capable of generating a snapshot of all data at as_of
, followed by a
listen of all updates.
For more details, see ReadHandle::snapshot
and Listen
.
Fields§
§snapshot: Option<Vec<LeasedBatchPart<T>>>
§listen: Listen<K, V, T, D>
Implementations§
source§impl<K, V, T, D> Subscribe<K, V, T, D>
impl<K, V, T, D> Subscribe<K, V, T, D>
fn new( snapshot_parts: Vec<LeasedBatchPart<T>>, listen: Listen<K, V, T, D>, ) -> Self
sourcepub async fn next(
&mut self,
listen_retry: Option<RetryParameters>,
) -> Vec<ListenEvent<T, LeasedBatchPart<T>>>
pub async fn next( &mut self, listen_retry: Option<RetryParameters>, ) -> Vec<ListenEvent<T, LeasedBatchPart<T>>>
Returns a LeasedBatchPart
enriched with the proper metadata.
First returns snapshot parts, until they’re exhausted, at which point begins returning listen parts.
The returned Antichain
represents the subscription progress as it will
be after the returned parts are fetched.
source§impl<K, V, T, D> Subscribe<K, V, T, D>
impl<K, V, T, D> Subscribe<K, V, T, D>
sourcepub async fn fetch_next(
&mut self,
) -> Vec<ListenEvent<T, ((Result<K, String>, Result<V, String>), T, D)>>
pub async fn fetch_next( &mut self, ) -> Vec<ListenEvent<T, ((Result<K, String>, Result<V, String>), T, D)>>
Equivalent to next
, but rather than returning a LeasedBatchPart
,
fetches and returns the data from within it.
sourcepub async fn fetch_batch_part(
&mut self,
part: LeasedBatchPart<T>,
) -> FetchedPart<K, V, T, D> ⓘ
pub async fn fetch_batch_part( &mut self, part: LeasedBatchPart<T>, ) -> FetchedPart<K, V, T, D> ⓘ
Fetches the contents of part
and returns its lease.
source§impl<K, V, T, D> Subscribe<K, V, T, D>
impl<K, V, T, D> Subscribe<K, V, T, D>
sourcepub async fn expire(self)
pub async fn expire(self)
Politely expires this subscribe, releasing its lease.
There is a best-effort impl in Drop for ReadHandle
to expire the
ReadHandle
held by the subscribe that wasn’t explicitly expired
with this method. When possible, explicit expiry is still preferred
because the Drop one is best effort and is dependant on a tokio
Handle being available in the TLC at the time of drop (which is a bit
subtle). Also, explicit expiry allows for control over when it happens.
Trait Implementations§
Auto Trait Implementations§
impl<K, V, T, D> Freeze for Subscribe<K, V, T, D>where
T: Freeze,
impl<K, V, T, D> !RefUnwindSafe for Subscribe<K, V, T, D>
impl<K, V, T, D> Send for Subscribe<K, V, T, D>
impl<K, V, T, D> Sync for Subscribe<K, V, T, D>
impl<K, V, T, D> Unpin for Subscribe<K, V, T, D>where
T: Unpin,
impl<K, V, T, D> !UnwindSafe for Subscribe<K, V, T, D>
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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.