MCPcopy Create free account
hub / github.com/catboost/catboost / TNamedChunkedDataReader

Method TNamedChunkedDataReader

library/cpp/on_disk/chunks/chunked_helpers.cpp:17–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15static const char* NamedChunkedDataMagic = "NamedChunkedData";
16
17TNamedChunkedDataReader::TNamedChunkedDataReader(const TBlob& blob)
18 : TChunkedDataReader(blob)
19{
20 if (TChunkedDataReader::GetBlocksCount() < 1)
21 throw yexception() << "Too few blocks";
22
23 size_t block = TChunkedDataReader::GetBlocksCount() - 1;
24 size_t magicLen = strlen(NamedChunkedDataMagic);
25 if (GetBlockLen(block) < magicLen || memcmp(GetBlock(block), NamedChunkedDataMagic, magicLen) != 0)
26 throw yexception() << "Not a valid named chunked data file";
27
28 TMemoryInput input(static_cast<const char*>(GetBlock(block)) + magicLen, GetBlockLen(block) - magicLen);
29 Load(&input, Names);
30
31 size_t index = 0;
32 for (TVector<TString>::const_iterator it = Names.begin(); it != Names.end(); ++it, ++index) {
33 if (!it->empty())
34 NameToIndex[*it] = index;
35 }
36}
37
38/*************************** TNamedChunkedDataWriter ***************************/
39

Callers

nothing calls this directly

Calls 7

yexceptionClass · 0.85
memcmpFunction · 0.85
GetBlockFunction · 0.85
LoadFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected