lsdb: rebuild using boost::multi_index to replace 3 LSA lists
refs: #4127
Co-authored-by: Nick Gordon <nmgordon@memphis.edu>
Change-Id: Ic179f90019e472157b0d61c6db02a4afaf4843b6
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index a2ec12b..74d3c11 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -52,9 +52,7 @@
void
RoutingTable::calculate()
{
- m_lsdb.writeCorLsdbLog();
- m_lsdb.writeNameLsdbLog();
- m_lsdb.writeAdjLsdbLog();
+ m_lsdb.writeLog();
m_namePrefixTable.writeLog();
if (m_isRoutingTableCalculating == false) {
// setting routing table calculation
@@ -63,14 +61,10 @@
bool isHrEnabled = m_confParam.getHyperbolicState() != HYPERBOLIC_STATE_OFF;
if ((!isHrEnabled &&
- m_lsdb
- .doesLsaExist(ndn::Name{m_confParam.getRouterPrefix()}
- .append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY)), Lsa::Type::ADJACENCY))
+ m_lsdb.doesLsaExist(m_confParam.getRouterPrefix(), Lsa::Type::ADJACENCY))
||
(isHrEnabled &&
- m_lsdb
- .doesLsaExist(ndn::Name{m_confParam.getRouterPrefix()}
- .append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE)), Lsa::Type::COORDINATE))) {
+ m_lsdb.doesLsaExist(m_confParam.getRouterPrefix(), Lsa::Type::COORDINATE))) {
if (m_lsdb.getIsBuildAdjLsaSheduled() != 1) {
NLSR_LOG_TRACE("Clearing old routing table");
clearRoutingTable();
@@ -80,8 +74,8 @@
NLSR_LOG_DEBUG("Calculating routing table");
// calculate Link State routing
- if ((m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_OFF)
- || (m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_DRY_RUN)) {
+ if ((m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_OFF) ||
+ (m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_DRY_RUN)) {
calculateLsRoutingTable();
}
// calculate hyperbolic routing
@@ -126,25 +120,26 @@
void
RoutingTable::calculateLsRoutingTable()
{
- NLSR_LOG_DEBUG("RoutingTable::calculateLsRoutingTable Called");
+ NLSR_LOG_TRACE("CalculateLsRoutingTable Called");
Map map;
- map.createFromAdjLsdb(m_lsdb.getAdjLsdb().begin(), m_lsdb.getAdjLsdb().end());
+ auto lsaRange = m_lsdb.getLsdbIterator<AdjLsa>();
+ map.createFromAdjLsdb(lsaRange.first, lsaRange.second);
map.writeLog();
size_t nRouters = map.getMapSize();
LinkStateRoutingTableCalculator calculator(nRouters);
- calculator.calculatePath(map, *this, m_confParam, m_lsdb.getAdjLsdb());
+ calculator.calculatePath(map, *this, m_confParam, m_lsdb);
}
void
RoutingTable::calculateHypRoutingTable(bool isDryRun)
{
Map map;
- map.createFromCoordinateLsdb(m_lsdb.getCoordinateLsdb().begin(),
- m_lsdb.getCoordinateLsdb().end());
+ auto lsaRange = m_lsdb.getLsdbIterator<CoordinateLsa>();
+ map.createFromCoordinateLsdb(lsaRange.first, lsaRange.second);
map.writeLog();
size_t nRouters = map.getMapSize();