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

Method RegisterLocalFile

libs/storage/storage.cpp:1236–1264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1234}
1235
1236void Storage::RegisterLocalFile(platform::LocalCountryFile const & localFile)
1237{
1238 LocalFilePtr ptr;
1239
1240 CountryId const & countryId = FindCountryId(localFile);
1241 if (IsLeaf(countryId))
1242 {
1243 ptr = GetLocalFile(countryId, localFile.GetVersion());
1244 if (!ptr)
1245 {
1246 ptr = make_shared<LocalCountryFile>(localFile);
1247 RegisterCountryFiles(ptr);
1248 }
1249 }
1250 else
1251 {
1252 ptr = make_shared<LocalCountryFile>(localFile);
1253 ptr->SyncWithDisk();
1254 m_localFilesForFakeCountries[ptr->GetCountryFile()] = ptr;
1255 }
1256
1257 uint64_t const size = ptr->GetSize(MapFileType::Map);
1258 LOG(LINFO, ("Found file:", countryId, "in directory:", ptr->GetDirectory(), "with size:", size));
1259
1260 /// Funny, but ptr->GetCountryFile() has valid name only. Size and sha1 are not initialized.
1261 /// @todo Store only name (CountryId) in LocalCountryFile instead of CountryFile?
1262 if (m_currentVersion == ptr->GetVersion() && size != GetCountryFile(countryId).GetRemoteSize())
1263 LOG(LWARNING, ("Inconsistent MWM and version for", *ptr));
1264}
1265
1266void Storage::DeleteCountryFiles(CountryId const & countryId, MapFileType type, bool deferredDelete)
1267{

Callers 1

UNIT_CLASS_TESTFunction · 0.80

Calls 4

SyncWithDiskMethod · 0.80
GetVersionMethod · 0.45
GetSizeMethod · 0.45
GetRemoteSizeMethod · 0.45

Tested by 1

UNIT_CLASS_TESTFunction · 0.64