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

Function ConstructAsMap

util/memory/blob.cpp:210–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208
209template <class TCounter, class T>
210static inline TBlob ConstructAsMap(const T& t, EMappingMode mode) {
211 TMemoryMap::EOpenMode openMode = (mode == EMappingMode::Precharged) ? (TMemoryMap::oRdOnly | TMemoryMap::oPrecharge) : TMemoryMap::oRdOnly;
212
213 TMemoryMap map(t, openMode);
214 const ui64 toMap = map.Length();
215
216 if (toMap > Max<size_t>()) {
217 ythrow yexception() << "can not map whole file(length = " << toMap << ")";
218 }
219
220 return ConstructFromMap<TCounter>(map, 0, static_cast<size_t>(toMap), mode);
221}
222
223TBlob TBlob::FromFileSingleThreaded(const TString& path, EMappingMode mode) {
224 return ConstructAsMap<TSimpleCounter>(path, mode);

Callers

nothing calls this directly

Calls 1

LengthMethod · 0.45

Tested by

no test coverage detected