dfir_rs/compiled/pull/half_join_state/
mod.rs

1mod fold;
2mod fold_from;
3mod multiset;
4mod reduce;
5mod set;
6
7pub use fold::HalfJoinStateFold;
8pub use fold_from::HalfJoinStateFoldFrom;
9pub use multiset::HalfMultisetJoinState;
10pub use reduce::HalfJoinStateReduce;
11pub use set::HalfSetJoinState;
12use smallvec::SmallVec;
13
14pub trait HalfJoinState<Key, ValBuild, ValProbe> {
15    /// Insert a key value pair into the join state, currently this is always inserting into a hash table
16    /// If the key-value pair exists then it is implementation defined what happens, usually either two copies are stored or only one copy is stored.
17    fn build(&mut self, k: Key, v: &ValBuild) -> bool;
18
19    /// This function does the actual joining part of the join. It looks up a key in the local join state and creates matches
20    /// The first match is return directly to the caller, and any additional matches are stored internally to be retrieved later with `pop_match`
21    fn probe(&mut self, k: &Key, v: &ValProbe) -> Option<(Key, ValProbe, ValBuild)>;
22
23    /// If there are any stored matches from previous calls to probe then this function will remove them one at a time and return it.
24    fn pop_match(&mut self) -> Option<(Key, ValProbe, ValBuild)>;
25    fn len(&self) -> usize;
26    fn is_empty(&self) -> bool {
27        self.len() == 0
28    }
29    fn iter(&self) -> std::collections::hash_map::Iter<'_, Key, SmallVec<[ValBuild; 1]>>;
30    fn full_probe(&self, k: &Key) -> std::slice::Iter<'_, ValBuild>;
31}