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

Method BuildSection

generator/descriptions_section_builder.cpp:209–236  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

207
208// static
209void DescriptionsSectionBuilder::BuildSection(std::string const & mwmFile, DescriptionsCollector & collector)
210{
211 auto const & stat = collector.m_stat;
212 size_t const size = stat.GetTotalSize();
213 LOG(LINFO, ("Wiki descriptions for", mwmFile, "Wikipedia urls =", stat.GetNumberOfWikipediaUrls(),
214 "Wikidata ids =", stat.GetNumberOfWikidataIds(), "Total number of pages =", stat.GetNumberOfPages(),
215 "Total size of added pages (before writing to section) =", size, "bytes"));
216 if (size == 0)
217 {
218 LOG(LWARNING, ("Section", DESCRIPTIONS_FILE_TAG, "was not created."));
219 return;
220 }
221
222 FilesContainerW cont(mwmFile, FileWriter::OP_WRITE_EXISTING);
223
224 /// @todo Should we override FilesContainerWriter::GetSize() to return local size (not container size)?
225 uint64_t sectionSize;
226 {
227 auto writer = cont.GetWriter(DESCRIPTIONS_FILE_TAG);
228 sectionSize = writer->Pos();
229 descriptions::Serializer serializer(std::move(collector.m_collection));
230 serializer.Serialize(*writer);
231 sectionSize = writer->Pos() - sectionSize;
232 }
233
234 LOG(LINFO, ("Section", DESCRIPTIONS_FILE_TAG, "is built.", "Disk size =", sectionSize, "bytes",
235 "Compression ratio =", size / double(sectionSize), stat.LangStatisticsToString()));
236}
237} // namespace generator

Callers

nothing calls this directly

Calls 8

GetTotalSizeMethod · 0.80
GetNumberOfPagesMethod · 0.80
GetWriterMethod · 0.80
PosMethod · 0.45
SerializeMethod · 0.45

Tested by

no test coverage detected