Skip to main content

HotGrouper

Trait HotGrouper 

Source
pub trait HotGrouper:
    Any
    + Send
    + Sync {
    // Required methods
    fn new_empty(&self, groups: usize) -> Box<dyn HotGrouper>;
    fn num_groups(&self) -> IdxSize;
    fn insert_keys(
        &mut self,
        keys: &HashKeys,
        hot_idxs: &mut Vec<IdxSize>,
        hot_group_idxs: &mut Vec<EvictIdx>,
        cold_idxs: &mut Vec<IdxSize>,
        force_hot: bool,
    );
    fn keys(&self) -> HashKeys;
    fn num_evictions(&self) -> usize;
    fn take_evicted_keys(&mut self) -> HashKeys;
    fn as_any(&self) -> &dyn Any;
}
Expand description

A HotGrouper maps keys to groups, such that duplicate keys map to the same group. Unlike a Grouper it has a fixed size and will cause evictions rather than growing.

Required Methods§

Source

fn new_empty(&self, groups: usize) -> Box<dyn HotGrouper>

Creates a new empty HotGrouper similar to this one, with the given size.

Source

fn num_groups(&self) -> IdxSize

Returns the number of groups in this HotGrouper.

Source

fn insert_keys( &mut self, keys: &HashKeys, hot_idxs: &mut Vec<IdxSize>, hot_group_idxs: &mut Vec<EvictIdx>, cold_idxs: &mut Vec<IdxSize>, force_hot: bool, )

Inserts the given keys into this Grouper, extending groups_idxs with the group index of keys[i].

Source

fn keys(&self) -> HashKeys

Get all the current hot keys, in group order.

Source

fn num_evictions(&self) -> usize

Get the number of evicted keys stored.

Source

fn take_evicted_keys(&mut self) -> HashKeys

Consume all the evicted keys from this HotGrouper.

Source

fn as_any(&self) -> &dyn Any

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§