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

Method DownloadCountry

libs/storage/storage.cpp:823–851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

821}
822
823void Storage::DownloadCountry(CountryId const & countryId, MapFileType type)
824{
825 CHECK_THREAD_CHECKER(m_threadChecker, ());
826
827 if (IsCountryInQueue(countryId) || IsDiffApplyingInProgressToCountry(countryId))
828 return;
829
830 m_failedCountries.erase(countryId);
831 auto const countryFile = GetCountryFile(countryId);
832 // If it's not even possible to prepare directory for files before
833 // downloading, then mark this country as failed and switch to next
834 // country.
835 if (!PreparePlaceForCountryFiles(m_currentVersion, m_dataDir, countryFile))
836 {
837 OnMapDownloadFinished(countryId, DownloadStatus::Failed, type);
838 return;
839 }
840
841 if (IsFileDownloaded(GetFileDownloadPath(countryId, type), type))
842 {
843 OnMapDownloadFinished(countryId, DownloadStatus::Completed, type);
844 return;
845 }
846
847 QueuedCountry queuedCountry(countryFile, countryId, type, m_currentVersion, m_dataDir, m_diffsDataSource);
848 queuedCountry.Subscribe(*this);
849
850 m_downloader->DownloadMapFile(std::move(queuedCountry));
851}
852
853void Storage::DeleteCountry(CountryId const & countryId, MapFileType type)
854{

Callers 3

PrepareCountriesMethod · 0.80
StartDownloadMethod · 0.80
UNIT_TESTFunction · 0.80

Calls 6

IsFileDownloadedFunction · 0.85
DownloadMapFileMethod · 0.80
GetFileDownloadPathFunction · 0.50
eraseMethod · 0.45
SubscribeMethod · 0.45

Tested by 2

StartDownloadMethod · 0.64
UNIT_TESTFunction · 0.64