mjschultz / py-radix

Python radix tree implementation for IPv4 and IPv6 prefix matching.
Other
121 stars 37 forks source link

[Work In Progress] Add search_covered method #8

Closed Habbie closed 9 years ago

Habbie commented 9 years ago

This new method rnodes = rtree.search_covered("10.123.0.0/16") allows you to find all nodes within a certain prefix.

Pull contains Python implementation that passes the tests I wrote, plus cursory inspection by @job, but I'm not 100% certain about correctness. Pull contains a C stub that is a copy of .prefixes() except it returns nodes, just so I can at least run the tests.

PRing this now to solicit feedback on the Python implementation, so that I can extend the tests if any issues are found, and write the C version then. Of course, if anybody feels like doing the C version, I won't complain ;)

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.47%) to 86.43% when pulling 1c3d9dd2fd5d18fccf8de7f766721ebafbfbd931 on Habbie:search_covered into 854d09c5e43aa2a0d3165284dd213be4b6bced3f on mjschultz:master.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.47%) to 86.43% when pulling 1c3d9dd2fd5d18fccf8de7f766721ebafbfbd931 on Habbie:search_covered into 854d09c5e43aa2a0d3165284dd213be4b6bced3f on mjschultz:master.

mjschultz commented 9 years ago

Seems fine to me. I can build up the C implementation if you really don't want to, though I'm not sure when I'll be able to make the time for it.

mjschultz commented 9 years ago

Changes added via https://github.com/mjschultz/py-radix/pull/12