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

Method DeleteSection

libs/coding/files_container.cpp:350–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350void FilesContainerW::DeleteSection(Tag const & tag)
351{
352 {
353 // rewrite files on disk
354 FilesContainerR contR(m_name);
355 FilesContainerW contW(m_name + ".tmp");
356
357 for (size_t i = 0; i < m_info.size(); ++i)
358 if (m_info[i].m_tag != tag)
359 contW.Write(contR.GetReader(m_info[i].m_tag), m_info[i].m_tag);
360 }
361
362 // swap files
363 if (!base::DeleteFileX(m_name) || !base::RenameFileX(m_name + ".tmp", m_name))
364 MYTHROW(RootException, ("Can't rename file", m_name, "Sharing violation or disk error!"));
365
366 // do open to update m_info
367 Open(FileWriter::OP_WRITE_EXISTING);
368}
369
370std::unique_ptr<FilesContainerWriter> FilesContainerW::GetWriter(Tag const & tag)
371{

Callers 2

DeleteSectionFunction · 0.80
SerializeRankTableFunction · 0.80

Calls 6

DeleteFileXFunction · 0.85
RenameFileXFunction · 0.85
OpenFunction · 0.85
sizeMethod · 0.45
WriteMethod · 0.45
GetReaderMethod · 0.45

Tested by

no test coverage detected