Skip to content

tqbf/aguritrie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aguri Ruby Extension

It's a fixed-size radix trie with an LRU bolted onto the side. When the tree fills up, the LRU is consulted to find 2 nodes to merge by rolling up prefixes (/32 to /31, for instance), freeing up a new node.

Nutshell:

require 'aguritrie'

tree = Aguri::IPTree.new 1024

1000.times {
  tree.add( (10<<24) + rand(1000), 1)
}

    tree.each do |ip, prefix, count, depth|
  pp [ " " * depth, "#{ ip }/#{ prefix }", count ]
    end

tree.dump # -> stderr

You can adapt this to things besides IP addresses. I've used it with memory address hits, for instance.

About

WIDE Aguri trie wrapper for Ruby

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published