Struct mz_persist_client::read::Subscribe
source · pub struct Subscribe<K, V, T, D>where
T: Timestamp + Lattice + Codec64,
K: Debug + Codec,
V: Debug + Codec,
D: Semigroup + Codec64 + Send + Sync,{ /* private fields */ }
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
.
Implementations§
source§impl<K, V, T, D> Subscribe<K, V, T, D>
impl<K, V, T, D> Subscribe<K, V, T, D>
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.
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.
sourcepub fn leased_part_from_exchangeable(
&self,
x: SerdeLeasedBatchPart
) -> LeasedBatchPart<T>
pub fn leased_part_from_exchangeable( &self, x: SerdeLeasedBatchPart ) -> LeasedBatchPart<T>
Takes a SerdeLeasedBatchPart
into a LeasedBatchPart
.
sourcepub fn return_leased_part(&mut self, leased_part: LeasedBatchPart<T>)
pub fn return_leased_part(&mut self, leased_part: LeasedBatchPart<T>)
Returns the given LeasedBatchPart
, releasing its lease.
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 to expire a listen 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> !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
.