Project

General

Profile

Actions

Task #4104

closed

Replace FibEntry with a tuple

Added by Nicholas Gordon almost 7 years ago. Updated almost 6 years ago.

Status:
Abandoned
Priority:
Normal
Assignee:
-
Target version:
Start date:
05/31/2017
Due date:
% Done:

0%

Estimated time:

Description

Currently the FibEntry is a class collecting pretty plain information. It is flawed in the following ways:

  1. It contains a copy of the Name, which also serves as the key to the map the Fib itself contains, wasting memory.
  2. It needlessly encapsulates the data in a way that confuses someone unfamiliar with the code.
  3. The entry is really just plain-old-data, and doesn't need any methods or functions associated with it, so the class abstraction carries too much logical overhead.
  4. The sequence number appears to be used only for debugging purposes. Not documenting it might lead a casual reader to assume that it has some other use.

Since the FIB conceptually is just a map that takes valid NDN name prefixes to a list of next-hops sorted by ascending cost, there is no need to complicate the abstraction with classes at no benefit.

Instead, the FibEntry class could be replaced with a std::tuple that contains the list of nexthops, the refresh event id, and the sequence number as elements. This preserves the mapping relationship, but also removes the need for an entire class that provides an unwieldy interface.

Actions

Also available in: Atom PDF