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§
Sourcefn new_empty(&self, groups: usize) -> Box<dyn HotGrouper>
fn new_empty(&self, groups: usize) -> Box<dyn HotGrouper>
Creates a new empty HotGrouper similar to this one, with the given size.
Sourcefn num_groups(&self) -> IdxSize
fn num_groups(&self) -> IdxSize
Returns the number of groups in this HotGrouper.
Sourcefn 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 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].
Sourcefn num_evictions(&self) -> usize
fn num_evictions(&self) -> usize
Get the number of evicted keys stored.
Sourcefn take_evicted_keys(&mut self) -> HashKeys
fn take_evicted_keys(&mut self) -> HashKeys
Consume all the evicted keys from this HotGrouper.
fn as_any(&self) -> &dyn Any
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".