pub trait GeneralizedHashTrieNode: Default {
type Schema: VariadicExt + Eq + Hash + Clone + SplitBySuffix<Self::SuffixSchema>;
type KeyType: VariadicExt + Eq + Hash + Clone;
type ValType: VariadicExt + Eq + Hash + Clone;
type Storage: VariadicCollection<Schema = Self::Schema> + Default + IntoIterator<Item = Self::Schema>;
type SuffixSchema: VariadicExt + Eq + Hash + Clone;
type Head: Eq + Hash + Clone;
const HEIGHT: usize;
// Required methods
fn new_from(input: impl IntoIterator<Item = Self::Schema>) -> Self;
fn merge_node(&mut self, other: Self) -> bool;
fn insert(&mut self, row: Self::Schema) -> bool;
fn contains<'a>(
&'a self,
row: <Self::Schema as VariadicExt>::AsRefVar<'a>,
) -> bool;
fn recursive_iter(
&self,
) -> impl Iterator<Item = <Self::Schema as VariadicExt>::AsRefVar<'_>>;
fn find_containing_leaf(
&self,
row: <Self::Schema as VariadicExt>::AsRefVar<'_>,
) -> Option<&GhtLeaf<Self::Schema, Self::ValType, Self::Storage>>;
fn into_iter(self) -> Option<impl Iterator<Item = Self::Schema>>;
fn drain(&mut self) -> Option<impl Iterator<Item = Self::Schema>>;
// Provided method
fn height(&self) -> usize { ... }
}
Expand description
The GeneralizedHashTrieNode trait captures the properties of nodes in a Ght.
The Ght, defined by Wang/Willsey/Suciu, is a hash-based trie for storing tuples.
It is parameterized by an ordered schema [VariadicExt
] of the relation stored in the trie.
It is a tree of GhtInner
nodes, with GhtLeaf
nodes at the leaves.
The trie is keyed on a prefix of the schema Self::KeyType
,
and the remaining columns Self::ValType
are stored in the leaf.
All leaf nodes use the same [Self::Storage]
type to store the data.
Required Associated Constants§
Required Associated Types§
Sourcetype Schema: VariadicExt + Eq + Hash + Clone + SplitBySuffix<Self::SuffixSchema>
type Schema: VariadicExt + Eq + Hash + Clone + SplitBySuffix<Self::SuffixSchema>
Schema variadic: the schema of the relation stored in this trie.
Sourcetype KeyType: VariadicExt + Eq + Hash + Clone
type KeyType: VariadicExt + Eq + Hash + Clone
The prefix of columns in Self::Schema
that the trie is keyed on
Sourcetype ValType: VariadicExt + Eq + Hash + Clone
type ValType: VariadicExt + Eq + Hash + Clone
The suffix of columns in Self::Schema
that are not part of the trie keys
Sourcetype Storage: VariadicCollection<Schema = Self::Schema> + Default + IntoIterator<Item = Self::Schema>
type Storage: VariadicCollection<Schema = Self::Schema> + Default + IntoIterator<Item = Self::Schema>
The type that holds the data in the leaves
Sourcetype SuffixSchema: VariadicExt + Eq + Hash + Clone
type SuffixSchema: VariadicExt + Eq + Hash + Clone
SuffixSchema variadic: the suffix of Self::Schema
from this node of the trie
downward. The first entry in this variadic is of type Self::Head
.
Required Methods§
Sourcefn new_from(input: impl IntoIterator<Item = Self::Schema>) -> Self
fn new_from(input: impl IntoIterator<Item = Self::Schema>) -> Self
Create a new Ght from the iterator.
Sourcefn merge_node(&mut self, other: Self) -> bool
fn merge_node(&mut self, other: Self) -> bool
Merge a matching Ght node into this node
Sourcefn contains<'a>(
&'a self,
row: <Self::Schema as VariadicExt>::AsRefVar<'a>,
) -> bool
fn contains<'a>( &'a self, row: <Self::Schema as VariadicExt>::AsRefVar<'a>, ) -> bool
Returns true
if the (entire) row is found below in the trie, false
otherwise.
See GhtGet::get
to look just for “head” keys in this node
Sourcefn recursive_iter(
&self,
) -> impl Iterator<Item = <Self::Schema as VariadicExt>::AsRefVar<'_>>
fn recursive_iter( &self, ) -> impl Iterator<Item = <Self::Schema as VariadicExt>::AsRefVar<'_>>
Iterate through (entire) rows stored in this HashTrie.
Sourcefn find_containing_leaf(
&self,
row: <Self::Schema as VariadicExt>::AsRefVar<'_>,
) -> Option<&GhtLeaf<Self::Schema, Self::ValType, Self::Storage>>
fn find_containing_leaf( &self, row: <Self::Schema as VariadicExt>::AsRefVar<'_>, ) -> Option<&GhtLeaf<Self::Schema, Self::ValType, Self::Storage>>
return the leaf below that contains this row, or None
if not found.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.