Struct mz_persist_client::fetch::Cursor
source · pub(crate) struct Cursor {
idx: usize,
}
Expand description
A pointer into a particular encoded part, with methods for fetching an update and scanning forward to the next. It is an error to use the same cursor for distinct parts.
We avoid implementing copy to make it hard to accidentally duplicate a cursor. However, clone is very cheap.
Fields§
§idx: usize
Implementations§
source§impl Cursor
impl Cursor
sourcepub fn get<'a, T: Timestamp + Lattice + Codec64>(
&self,
encoded: &'a EncodedPart<T>,
) -> Option<(&'a [u8], &'a [u8], T, [u8; 8])>
pub fn get<'a, T: Timestamp + Lattice + Codec64>( &self, encoded: &'a EncodedPart<T>, ) -> Option<(&'a [u8], &'a [u8], T, [u8; 8])>
Get the tuple at the specified pair of indices. If there is no such tuple,
either because we are out of range or because this tuple has been filtered out,
this returns None
.
sourcepub fn peek<'a, T: Timestamp + Lattice + Codec64>(
&mut self,
part: &'a EncodedPart<T>,
) -> Option<(&'a [u8], &'a [u8], T, [u8; 8])>
pub fn peek<'a, T: Timestamp + Lattice + Codec64>( &mut self, part: &'a EncodedPart<T>, ) -> Option<(&'a [u8], &'a [u8], T, [u8; 8])>
A cursor points to a particular update in the backing part data. If the update it points to is not valid, advance it to the next valid update if there is one, and return the pointed-to data.
sourcepub fn pop<'a, T: Timestamp + Lattice + Codec64>(
&mut self,
part: &'a EncodedPart<T>,
) -> Option<((&'a [u8], &'a [u8], T, [u8; 8]), usize)>
pub fn pop<'a, T: Timestamp + Lattice + Codec64>( &mut self, part: &'a EncodedPart<T>, ) -> Option<((&'a [u8], &'a [u8], T, [u8; 8]), usize)>
Similar to peek, but advance the cursor just past the end of the most recent update.
Returns the update and the (part_idx, idx)
that is was popped at.
sourcepub fn is_exhausted<T: Timestamp + Codec64>(
&self,
part: &EncodedPart<T>,
) -> bool
pub fn is_exhausted<T: Timestamp + Codec64>( &self, part: &EncodedPart<T>, ) -> bool
Returns true if the cursor is past the end of the part data.
sourcepub fn advance<T: Timestamp + Codec64>(&mut self, part: &EncodedPart<T>)
pub fn advance<T: Timestamp + Codec64>(&mut self, part: &EncodedPart<T>)
Advance the cursor just past the end of the most recent update, if there is one.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnwindSafe for Cursor
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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<T> ProgressEventTimestamp for T
impl<T> ProgressEventTimestamp 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
.