pub struct FullKeyTracker<T: AsRef<[u8]> + Ord + Eq, const SKIP_DEDUP: bool = false> {
pub latest_full_key: FullKey<T>,
last_observed_epoch_with_gap: EpochWithGap,
}
Expand description
TODO: Temporary bypass full key check. Remove this field after #15099 is resolved.
Fields§
§latest_full_key: FullKey<T>
§last_observed_epoch_with_gap: EpochWithGap
Implementations§
source§impl<T: AsRef<[u8]> + Ord + Eq, const SKIP_DEDUP: bool> FullKeyTracker<T, SKIP_DEDUP>
impl<T: AsRef<[u8]> + Ord + Eq, const SKIP_DEDUP: bool> FullKeyTracker<T, SKIP_DEDUP>
pub fn new(init_full_key: FullKey<T>) -> Self
sourcepub fn observe<F>(&mut self, key: FullKey<F>) -> bool
pub fn observe<F>(&mut self, key: FullKey<F>) -> bool
Check and observe a new full key during iteration
§Examples:
use bytes::Bytes;
use risingwave_common::catalog::TableId;
use risingwave_common::util::epoch::EPOCH_AVAILABLE_BITS;
use risingwave_hummock_sdk::EpochWithGap;
use risingwave_hummock_sdk::key::{FullKey, FullKeyTracker, TableKey};
let table_id = TableId { table_id: 1 };
let full_key1 = FullKey::new(table_id, TableKey(Bytes::from("c")), 5 << EPOCH_AVAILABLE_BITS);
let mut a: FullKeyTracker<_> = FullKeyTracker::<Bytes>::new(full_key1.clone());
// Panic on non-decreasing epoch observed for the same user key.
// let full_key_with_larger_epoch = FullKey::new(table_id, TableKey(Bytes::from("c")), 6 << EPOCH_AVAILABLE_BITS);
// a.observe(full_key_with_larger_epoch);
// Panic on non-increasing user key observed.
// let full_key_with_smaller_user_key = FullKey::new(table_id, TableKey(Bytes::from("b")), 3 << EPOCH_AVAILABLE_BITS);
// a.observe(full_key_with_smaller_user_key);
let full_key2 = FullKey::new(table_id, TableKey(Bytes::from("c")), 3 << EPOCH_AVAILABLE_BITS);
assert_eq!(a.observe(full_key2.clone()), false);
assert_eq!(a.latest_user_key(), &full_key2.user_key);
let full_key3 = FullKey::new(table_id, TableKey(Bytes::from("f")), 4 << EPOCH_AVAILABLE_BITS);
assert_eq!(a.observe(full_key3.clone()), true);
assert_eq!(a.latest_user_key(), &full_key3.user_key);
Return:
- If the provided
key
contains a new user key, return true. - Otherwise: return false
sourcepub fn observe_multi_version<F>(
&mut self,
user_key: UserKey<F>,
epochs: impl Iterator<Item = EpochWithGap>,
) -> bool
pub fn observe_multi_version<F>( &mut self, user_key: UserKey<F>, epochs: impl Iterator<Item = EpochWithGap>, ) -> bool
epochs
comes from greater to smaller
pub fn latest_user_key(&self) -> &UserKey<T>
Auto Trait Implementations§
impl<T, const SKIP_DEDUP: bool> Freeze for FullKeyTracker<T, SKIP_DEDUP>where
T: Freeze,
impl<T, const SKIP_DEDUP: bool> RefUnwindSafe for FullKeyTracker<T, SKIP_DEDUP>where
T: RefUnwindSafe,
impl<T, const SKIP_DEDUP: bool> Send for FullKeyTracker<T, SKIP_DEDUP>where
T: Send,
impl<T, const SKIP_DEDUP: bool> Sync for FullKeyTracker<T, SKIP_DEDUP>where
T: Sync,
impl<T, const SKIP_DEDUP: bool> Unpin for FullKeyTracker<T, SKIP_DEDUP>where
T: Unpin,
impl<T, const SKIP_DEDUP: bool> UnwindSafe for FullKeyTracker<T, SKIP_DEDUP>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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> 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>
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 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>
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 moresource§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>
Wrap the input message
T
in a tonic::Request
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
Equivalent to
RelabeledMetricVec::with_metric_level
.source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
Equivalent to
RelabeledMetricVec::with_metric_level_relabel_n
.source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
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.