Task #4482
closedRefactor LsaSegmentStorage
0%
Description
The way LsaSegmentStorage has been implemented is inefficient for deleting LSA segments that belongs to the same Data packet. Currently each LSA segments is a separate element in a std::unorederd_map where segment name is the key. So if we need to delete LSA segments of a same LSA Data, then we need to walkthrough the map to find those segments one by one which is in O(n).
Instead we can do the following:
(1) Have a class called LsaData, which has member variable Seq No and a list of lsa segments, .e.g std::vectorndn::Data
(2) Have another class called LsaSegmentStorage, which have a hashmap of LsaData indexed by LsaKeyName (///), e.g. std:unordered_map
Each element in the container represents a list of segments that belongs to the same LSA Data.