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

Method CalculateProgress

libs/storage/storage.cpp:2036–2066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2034}
2035
2036Progress Storage::CalculateProgress(CountriesVec const & descendants) const
2037{
2038 // Function calculates progress correctly ONLY if |downloadingMwm| is leaf.
2039
2040 Progress result;
2041
2042 auto const mwmsInQueue = GetQueuedCountries(m_downloader->GetQueue());
2043 for (auto const & d : descendants)
2044 {
2045 auto const downloadingIt = m_downloadingCountries.find(d);
2046 if (downloadingIt != m_downloadingCountries.cend())
2047 {
2048 if (!downloadingIt->second.IsUnknown())
2049 result.m_bytesDownloaded += downloadingIt->second.m_bytesDownloaded;
2050
2051 result.m_bytesTotal += GetRemoteSize(GetCountryFile(d));
2052 }
2053 else if (mwmsInQueue.count(d) != 0)
2054 {
2055 result.m_bytesTotal += GetRemoteSize(GetCountryFile(d));
2056 }
2057 else if (m_justDownloaded.count(d) != 0)
2058 {
2059 MwmSize const localCountryFileSz = GetRemoteSize(GetCountryFile(d));
2060 result.m_bytesDownloaded += localCountryFileSz;
2061 result.m_bytesTotal += localCountryFileSz;
2062 }
2063 }
2064
2065 return result;
2066}
2067
2068void Storage::UpdateNode(CountryId const & countryId)
2069{

Callers

nothing calls this directly

Calls 7

GetQueuedCountriesFunction · 0.85
GetRemoteSizeFunction · 0.85
GetQueueMethod · 0.45
findMethod · 0.45
cendMethod · 0.45
IsUnknownMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected