static
| 207 | |
| 208 | // static |
| 209 | void 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 |
nothing calls this directly
no test coverage detected