risingwave_storage::hummock::iterator::forward_user

Struct UserIterator

source
pub struct UserIterator<I: HummockIterator<Direction = Forward>> {
    iterator: I,
    full_key_tracker: FullKeyTracker<Vec<u8>, true>,
    key_range: UserKeyRange,
    read_epoch: HummockEpoch,
    min_epoch: HummockEpoch,
    _version: Option<PinnedVersion>,
    stats: StoreLocalStatistic,
    is_current_pos_valid: bool,
}
Expand description

UserIterator can be used by user directly.

Fields§

§iterator: I

Inner table iterator.

§full_key_tracker: FullKeyTracker<Vec<u8>, true>§key_range: UserKeyRange

Start and end bounds of user key.

§read_epoch: HummockEpoch

Only reads values if ts <= self.read_epoch.

§min_epoch: HummockEpoch

Only reads values if ts > self.min_epoch. use for ttl

§_version: Option<PinnedVersion>

Ensures the SSTs needed by iterator won’t be vacuumed.

§stats: StoreLocalStatistic§is_current_pos_valid: bool

Whether the iterator is pointing to a valid position

Implementations§

source§

impl<I: HummockIterator<Direction = Forward>> UserIterator<I>

source

pub(crate) fn new( iterator: I, key_range: UserKeyRange, read_epoch: u64, min_epoch: u64, version: Option<PinnedVersion>, ) -> Self

Create UserIterator with given read_epoch.

source

pub fn for_test(iterator: I, key_range: UserKeyRange) -> Self

Create UserIterator with maximum epoch.

source

pub async fn next(&mut self) -> HummockResult<()>

Gets the iterator move to the next step. See IteratorState for the state machine details.

Returned result:

  • if Ok(()) is returned, it means that the iterator successfully move to the next position (may reach to the end and thus not valid)
  • if Err(_) is returned, it means that some error happened.
source

pub fn key(&self) -> FullKey<&[u8]>

Returns the key with the newest version. Thus no version in it, and only the user_key will be returned.

The returned key is de-duplicated and thus it will not output the same key, unless the rewind or seek methods are called.

Note: before call the function you need to ensure that the iterator is valid.

source

pub fn value(&self) -> &[u8]

The returned value is in the form of user value.

Note: before call the function you need to ensure that the iterator is valid.

source

pub async fn rewind(&mut self) -> HummockResult<()>

Resets the iterating position to the beginning.

source

pub async fn seek(&mut self, user_key: UserKey<&[u8]>) -> HummockResult<()>

Resets the iterating position to the first position where the key >= provided key.

source

pub fn is_valid(&self) -> bool

Indicates whether the iterator can be used.

source

pub fn collect_local_statistic(&self, stats: &mut StoreLocalStatistic)

source

async fn try_advance_to_next_valid(&mut self) -> HummockResult<()>

Advance the inner iterator to a valid position, in which the entry can be exposed. Iterator will not be advanced if it already pointed to a valid position.

source

fn user_key_out_of_range(&self, user_key: UserKey<&[u8]>) -> bool

Auto Trait Implementations§

§

impl<I> !Freeze for UserIterator<I>

§

impl<I> !RefUnwindSafe for UserIterator<I>

§

impl<I> Send for UserIterator<I>

§

impl<I> Sync for UserIterator<I>
where I: Sync,

§

impl<I> Unpin for UserIterator<I>
where I: Unpin,

§

impl<I> !UnwindSafe for UserIterator<I>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> IntoResult<T> for T

§

type Err = Infallible

§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>

§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
source§

impl<M> MetricVecRelabelExt for M

source§

fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>

source§

fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>

source§

fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>

Equivalent to RelabeledMetricVec::with_metric_level_relabel_n with metric_level set to MetricLevel::Debug and relabel_num set to 1.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> LruValue for T
where T: Send + Sync,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> Value for T
where T: Send + Sync + 'static,