-
-
Notifications
You must be signed in to change notification settings - Fork 10
MRT updates iterator #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MRT updates iterator #254
Conversation
Add MrtUpdate enum plus Bgp4MpUpdate and TableDumpV2Entry structs and BgpkitParser::into_update_iter() and into_fallible_update_iter() to iterate BGP4MP UPDATEs and TableDumpV2 RIB entries. Include example, tests and a benchmark.
|
This addresses issue #250 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #254 +/- ##
==========================================
- Coverage 90.87% 90.50% -0.37%
==========================================
Files 80 81 +1
Lines 12588 13006 +418
==========================================
+ Hits 11439 11771 +332
- Misses 1149 1235 +86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request introduces a new intermediate data structure MrtUpdate and associated iterators (UpdateIterator and FallibleUpdateIterator) to the BGPKit parser. This provides a middle ground between the low-level MrtRecord and high-level BgpElem representations, optimizing for cases where per-prefix attribute duplication is unnecessary. The change enhances the parser's flexibility and performance for batch processing of BGP announcements without expanding them into individual per-prefix elements.
Key changes:
- New
MrtUpdateenum with variants for BGP4MP updates, TableDumpV2 RIB entries, and legacy TableDump messages - Two new iterator types:
UpdateIterator(error-skipping) andFallibleUpdateIterator(error-exposing) - Comprehensive documentation and examples demonstrating the performance benefits
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/parser/iters/update.rs |
Core implementation of the new iterator types, data structures (Bgp4MpUpdate, TableDumpV2Entry, MrtUpdate), and error handling logic |
src/parser/iters/mod.rs |
Integration of new iterators into the parser module, exposing into_update_iter() and into_fallible_update_iter() methods with documentation |
src/lib.rs |
Updated crate-level documentation to describe the three-way data representation model and provide usage guidance |
examples/update_messages_iter.rs |
New comprehensive example demonstrating UpdateIterator usage and comparing performance with ElemIterator |
examples/README.md |
Added documentation entry for the new example |
benches/internals.rs |
Added benchmarks for the new into_update_iter() method on both updates and RIB dump files |
README.md |
Updated data representation documentation to include MrtUpdate in the three-way model |
CHANGELOG.md |
Documented the new feature, structs, and methods in the unreleased section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When core_dump is enabled, write available record bytes to mrt_core_dump on parse errors. Also fix minor typos in CHANGELOG and examples README
This pull request introduces a new intermediate data structure,
MrtUpdate, and associated iterators to the BGPKit parser, providing a more efficient way to process BGP announcements. It updates documentation, benchmarks, and examples to reflect and demonstrate these new capabilities. The changes are grouped below by theme.New Features and API Additions
UpdateIteratorandFallibleUpdateIteratorfor iterating over BGP announcements, with the newMrtUpdateenum supporting both BGP4MP UPDATE messages and TableDumpV2 RIB entries. Also introducedBgp4MpUpdateandTableDumpV2Entrystructs, and new methods (into_update_iter,into_fallible_update_iter) onBgpkitParserfor efficient batch processing. [1] [2]Documentation and Examples
README.md, crate-level docs (src/lib.rs), and changelog to describe the newMrtUpdaterepresentation, compare it to existing approaches, and clarify memory/performance trade-offs. Added a new example (examples/update_messages_iter.rs) to demonstrate usage and performance comparison.Benchmarking
into_update_iteron both updates and rib dump files to measure and compare performance with existing iterators. [1] [2]These changes enhance the parser's flexibility and efficiency, making it easier to choose the right data structure for different BGP analysis tasks.