pub struct NameTrie<V: Clone + Send + Sync + 'static> { /* private fields */ }Expand description
A concurrent name trie mapping name prefixes to values of type V.
Uses per-node RwLock so that many readers can descend simultaneously
without holding parent locks. This is the shared structure used by both
the FIB and the StrategyTable.
Implementations§
Source§impl<V: Clone + Send + Sync + 'static> NameTrie<V>
impl<V: Clone + Send + Sync + 'static> NameTrie<V>
pub fn new() -> Self
Sourcepub fn lpm(&self, name: &Name) -> Option<V>
pub fn lpm(&self, name: &Name) -> Option<V>
Longest-prefix match — returns the value at the deepest matching node.
Sourcepub fn get(&self, name: &Name) -> Option<V>
pub fn get(&self, name: &Name) -> Option<V>
Exact-prefix lookup — only returns a value if name exactly matches
a registered prefix.
Sourcepub fn remove(&self, name: &Name)
pub fn remove(&self, name: &Name)
Remove the value at exactly name. Does not prune empty nodes.
Sourcepub fn dump(&self) -> Vec<(Name, V)>
pub fn dump(&self) -> Vec<(Name, V)>
Walk the entire trie and return all (Name, V) pairs in depth-first order.
Sourcepub fn descendants(&self, prefix: &Name) -> Vec<V>
pub fn descendants(&self, prefix: &Name) -> Vec<V>
Collect all values stored at or below prefix in the trie.
Used for prefix-based eviction (e.g. cs erase /prefix).
Sourcepub fn first_descendant(&self, prefix: &Name) -> Option<V>
pub fn first_descendant(&self, prefix: &Name) -> Option<V>
Returns the first value found at or below prefix in the trie.
Used for CanBePrefix CS lookups: walk to the Interest name position,
then return any Data stored at or below that node. The traversal order
within a level is unspecified (HashMap iteration order).