MCPcopy Create free account
hub / github.com/comaps/comaps / RegisterAllLocalMaps

Method RegisterAllLocalMaps

libs/storage/storage.cpp:595–635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

593}
594
595void Storage::RegisterAllLocalMaps(bool enableDiffs /* = false */)
596{
597 // CHECK_THREAD_CHECKER(m_threadChecker, ());
598 // ASSERT(!IsDownloadInProgress(), ());
599
600 m_localFiles.clear();
601 m_localFilesForFakeCountries.clear();
602
603 vector<LocalCountryFile> localFiles;
604 FindAllLocalMapsAndCleanup(m_currentVersion, m_dataDir, localFiles);
605
606 sort(localFiles.begin(), localFiles.end(), [](LocalCountryFile const & lhs, LocalCountryFile const & rhs)
607 {
608 if (lhs.GetCountryFile() != rhs.GetCountryFile())
609 return lhs.GetCountryFile() < rhs.GetCountryFile();
610 return lhs.GetVersion() > rhs.GetVersion();
611 });
612
613 auto i = localFiles.begin();
614 while (i != localFiles.end())
615 {
616 auto j = i + 1;
617 while (j != localFiles.end() && i->GetCountryFile() == j->GetCountryFile())
618 {
619 LocalCountryFile & localFile = *j;
620 LOG(LINFO, ("Removing obsolete", localFile));
621 localFile.SyncWithDisk();
622
623 DeleteFromDiskWithIndexes(localFile, MapFileType::Map);
624 DeleteFromDiskWithIndexes(localFile, MapFileType::Diff);
625 ++j;
626 }
627
628 RegisterLocalFile(*i);
629 i = j;
630 }
631
632 FindAllDiffs(m_dataDir, m_notAppliedDiffs);
633 // if (enableDiffs)
634 // LoadDiffScheme();
635}
636
637void Storage::GetLocalMaps(vector<LocalFilePtr> & maps) const
638{

Callers 11

CmdMatchFunction · 0.80
UnzipAndMatchFunction · 0.80
CmdBalanceCsvFunction · 0.80
CmdTagsTableFunction · 0.80
InitStorageFunction · 0.80
InitStorageFunction · 0.80
InitStorageFunction · 0.80
TestDownloadDeleteFunction · 0.80
InitStorageFunction · 0.80
UNIT_TESTFunction · 0.80
RegisterAllMapsMethod · 0.80

Calls 8

FindAllDiffsFunction · 0.85
SyncWithDiskMethod · 0.80
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetVersionMethod · 0.45

Tested by 6

InitStorageFunction · 0.64
InitStorageFunction · 0.64
InitStorageFunction · 0.64
TestDownloadDeleteFunction · 0.64
InitStorageFunction · 0.64
UNIT_TESTFunction · 0.64