risingwave_stream::executor::top_n::top_n_cache

Trait TopNCacheTrait

source
pub trait TopNCacheTrait {
    // Required methods
    fn insert(
        &mut self,
        cache_key: (Vec<u8>, Vec<u8>),
        row: impl Row + Send,
        staging: &mut TopNStaging,
    );
    fn delete<S: StateStore>(
        &mut self,
        group_key: Option<impl GroupKey>,
        managed_state: &mut ManagedTopNState<S>,
        cache_key: (Vec<u8>, Vec<u8>),
        row: impl Row + Send,
        staging: &mut TopNStaging,
    ) -> impl Future<Output = StreamExecutorResult<()>> + Send;
}
Expand description

This trait is used as a bound. It is needed since TopNCache::<true>::f and TopNCache::<false>::f don’t imply TopNCache::<WITH_TIES>::f.

Required Methods§

source

fn insert( &mut self, cache_key: (Vec<u8>, Vec<u8>), row: impl Row + Send, staging: &mut TopNStaging, )

Insert input row to corresponding cache range according to its order key.

Changes in self.middle is recorded to res_ops and res_rows, which will be used to generate messages to be sent to downstream operators.

source

fn delete<S: StateStore>( &mut self, group_key: Option<impl GroupKey>, managed_state: &mut ManagedTopNState<S>, cache_key: (Vec<u8>, Vec<u8>), row: impl Row + Send, staging: &mut TopNStaging, ) -> impl Future<Output = StreamExecutorResult<()>> + Send

Delete input row from the cache.

Changes in self.middle is recorded to res_ops and res_rows, which will be used to generate messages to be sent to downstream operators.

Because we may need to refill data from the state table to self.high during the delete operation, we need to pass in group_key, epoch and managed_state to do a prefix scan of the state table.

Object Safety§

This trait is not object safe.

Implementors§