Rebuild the LSDB
The LSDB is verbose and repetitive, and it can be better designed to be more concise and readable.
Updated by Ashlesh Gawande over 1 year ago
- Assignee changed from Saurab Dulal to Ashlesh Gawande
https://gerrit.named-data.net/c/NLSR/+/4749 patch-set 11 makes minimum changes to replace the three std::list used for Lsas with the proposed boost::multi_index container in previous patch-sets. Although it does not separate LsaFetcher and LsaPublisher as the previous patch-sets, it still reduces the Lsdb from ~1300 lines to ~630 lines with templating and polymorphism. Changes outside the Lsdb are kept to a minimum for easier review and have all the tests be passed w/ minimum modifications.
Other refactoring can follow as desired after the basic premise of this change of using a single multi_index container for Lsdb is achieved.
Some highlights that may need explicit review:
- Block m_wire is eliminated from child LSA classes and now resides in LSA base class (replacing the m_baseWire). These were introduced in #4787
- LSA base class has a public pure virtual wireEncode() - this maybe not desired in a library, but I think having it in NLSR is perfectly fine. wireEncode(block) and wireDecode(block) are protected, to be used by child classes.
Updated by Ashlesh Gawande 8 months ago
https://gerrit.named-data.net/c/NLSR/+/6217 makes the following changes to simplify Lsdb further:
- Lsdb emits a signal containing a pointer to Lsa, an update type (Inserted, Updated, Removed), and two lists of Names
- List of Names are only relevant to NameLsa update - Names to be removed and Names to be added.
- Lsa base class now has a pure virtual update function so that Lsdb does not need to cast the pointer and then call functions according to each Lsa
- RoutingTable consumes the Lsdb signal
- Behaviours which were in Lsdb such as removing routing table if own Adjacency Lsa is removed are moved to RoutingTable
- Resets wire when routing table is updated (seems like current code does not - so will return old routing table once calculated)
- calculate function in RoutingTable is simplified
- NamePrefixTable consumes the Lsdb signal
- Adds/Removes origin router of LSAs
- Adds/Removes updates from NameLsa
Unit tests are added to test that the behavior upon signal emission/consumption is correct in Lsdb, RoutingTable and NamePrefixTable