forked from organicmaps/organicmaps
[generator:geo_objects] Fix for review
This commit is contained in:
parent
3f249670a8
commit
694b61f884
3 changed files with 8 additions and 11 deletions
|
@ -191,15 +191,12 @@ void BuildGeoObjectsWithAddresses(KeyValueStorage & geoObjectsKv,
|
|||
auto json = KeyValueStorage::JsonString{json_dumps(jsonValue.get(),
|
||||
JSON_REAL_PRECISION(regions::JsonPolicy::kDefaultPrecision) | JSON_COMPACT)};
|
||||
|
||||
if (!GeoObjectsFilter::HasHouse(fb))
|
||||
jsonValue.reset(); // no cache JSON model
|
||||
|
||||
std::lock_guard<std::mutex> lock(updateMutex);
|
||||
geoObjectsKv.Insert(id, std::move(json), std::move(jsonValue));
|
||||
geoObjectsKv.Insert(id, std::move(json)); // no cache JSON model
|
||||
};
|
||||
|
||||
ForEachParallelFromDatRawFormat(threadsCount, pathInGeoObjectsTmpMwm, concurrentTransformer);
|
||||
LOG(LINFO, ("Added ", geoObjectsKv.Size(), "geo objects with addresses."));
|
||||
LOG(LINFO, ("Added", geoObjectsKv.Size(), "geo objects with addresses."));
|
||||
}
|
||||
|
||||
void BuildGeoObjectsWithoutAddresses(KeyValueStorage & geoObjectsKv,
|
||||
|
@ -265,7 +262,7 @@ bool GenerateGeoObjects(std::string const & pathInRegionsIndex,
|
|||
pathInGeoObjectsTmpMwm);
|
||||
|
||||
Platform().RemoveFileIfExists(pathOutGeoObjectsKv);
|
||||
KeyValueStorage geoObjectsKv(pathOutGeoObjectsKv, 10'000'000);
|
||||
KeyValueStorage geoObjectsKv(pathOutGeoObjectsKv, 0 /* cacheValuesCountLimit */);
|
||||
BuildGeoObjectsWithAddresses(geoObjectsKv, regionInfoGetter, pathInGeoObjectsTmpMwm,
|
||||
verbose, threadsCount);
|
||||
LOG(LINFO, ("Geo objects with addresses were built."));
|
||||
|
|
|
@ -25,7 +25,7 @@ KeyValueStorage::KeyValueStorage(std::string const & path, size_t cacheValuesCou
|
|||
|
||||
uint64_t key;
|
||||
auto value = std::string{};
|
||||
if (!ParseKeyValueLine(line, key, value, lineNumber))
|
||||
if (!ParseKeyValueLine(line, lineNumber, key, value))
|
||||
continue;
|
||||
|
||||
json_error_t jsonError;
|
||||
|
@ -49,8 +49,8 @@ KeyValueStorage::KeyValueStorage(std::string const & path, size_t cacheValuesCou
|
|||
}
|
||||
|
||||
// static
|
||||
bool KeyValueStorage::ParseKeyValueLine(std::string const & line, uint64_t & key,
|
||||
std::string & value, std::streamoff lineNumber)
|
||||
bool KeyValueStorage::ParseKeyValueLine(std::string const & line, std::streamoff lineNumber,
|
||||
uint64_t & key, std::string & value)
|
||||
{
|
||||
auto const pos = line.find(" ");
|
||||
if (pos == std::string::npos)
|
||||
|
|
|
@ -59,8 +59,8 @@ private:
|
|||
using Value = boost::variant<std::shared_ptr<JsonValue>, JsonString>;
|
||||
|
||||
static bool DefaultPred(KeyValue const &) { return true; }
|
||||
static bool ParseKeyValueLine(std::string const & line, uint64_t & key, std::string & value,
|
||||
std::streamoff lineNumber);
|
||||
static bool ParseKeyValueLine(std::string const & line, std::streamoff lineNumber,
|
||||
uint64_t & key, std::string & value);
|
||||
JsonString CopyJsonString(std::string const & value) const;
|
||||
|
||||
std::fstream m_storage;
|
||||
|
|
Loading…
Add table
Reference in a new issue