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

Method ApplyCountriesInMemory

libs/storage/storage.cpp:160–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158} // namespace
159
160void Storage::ApplyCountriesInMemory(std::string const & buffer)
161{
162 LOG(LDEBUG, ("COUNTRIES: applying in-memory"));
163 /// @todo(pastk): why do we need a temp dummy Storage object?
164 std::shared_ptr<Storage> parsed(new Storage(7 /* dummy */));
165 int64_t const newVersion =
166 LoadCountriesFromBuffer(buffer, parsed->m_countries, parsed->m_affiliations, parsed->m_countryNameSynonyms,
167 parsed->m_mwmTopCityGeoIds, parsed->m_mwmTopCountryGeoIds, parsed->m_mapSeries);
168
169 ASSERT_GREATER(newVersion, m_currentVersion, ());
170
171 m_currentVersion = newVersion;
172 m_countries = std::move(parsed->m_countries);
173
174 m_downloader->SetDataVersion(m_currentVersion);
175 m_downloader->ResetMetaConfig();
176
177 RegisterAllLocalMaps(false /* enableDiffs */);
178
179 m_affiliations = std::move(parsed->m_affiliations);
180 m_countryNameSynonyms = std::move(parsed->m_countryNameSynonyms);
181 m_mwmTopCityGeoIds = std::move(parsed->m_mwmTopCityGeoIds);
182 m_mwmTopCountryGeoIds = std::move(parsed->m_mwmTopCountryGeoIds);
183
184 NotifyStatusChanged(GetRootId());
185
186 for (auto const & p : m_localFiles)
187 if (IsNode(p.first))
188 NotifyStatusChangedForHierarchy(p.first);
189
190 LOG(LDEBUG, ("COUNTRIES: applied in-memory, new version", m_currentVersion));
191 NotifyCheckUpdatesResult(storage::CheckUpdatesStatus::Updated);
192}
193
194void Storage::ApplyPendingCountriesIfAny()
195{

Callers

nothing calls this directly

Calls 4

LoadCountriesFromBufferFunction · 0.85
GetRootIdFunction · 0.85
SetDataVersionMethod · 0.80
ResetMetaConfigMethod · 0.80

Tested by

no test coverage detected