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

Method SaveChunks

libs/platform/chunks_download_strategy.cpp:89–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void ChunksDownloadStrategy::SaveChunks(int64_t fileSize, std::string const & fName)
90{
91 if (!m_chunks.empty())
92 {
93 try
94 {
95 FileWriter w(fName);
96 WriteVarInt(w, fileSize);
97
98 w.Write(&m_chunks[0], sizeof(ChunkT) * m_chunks.size());
99 return;
100 }
101 catch (FileWriter::Exception const & e)
102 {
103 LOG(LWARNING, ("Can't save chunks statuses to file", e.Msg()));
104 }
105 }
106
107 // Delete if no chunks or some error occured.
108 UNUSED_VALUE(Platform::RemoveFileIfExists(fName));
109}
110
111int64_t ChunksDownloadStrategy::LoadOrInitChunks(std::string const & fName, int64_t fileSize, int64_t chunkSize)
112{

Callers 2

SaveResumeChunksMethod · 0.80
UNIT_TESTFunction · 0.80

Calls 4

WriteVarIntFunction · 0.85
emptyMethod · 0.45
WriteMethod · 0.45
sizeMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.64