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

Method Reserve

util/system/file.cpp:418–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418bool TFileHandle::Reserve(i64 length) noexcept {
419 // FIXME this should reserve disk space with fallocate
420 if (!IsOpen()) {
421 return false;
422 }
423 i64 currentLength = GetLength();
424 if (length <= currentLength) {
425 return true;
426 }
427 if (!Resize(length)) {
428 return false;
429 }
430#if defined(_win_)
431 if (!::SetFileValidData(Fd_, length)) {
432 Resize(currentLength);
433 return false;
434 }
435#elif defined(_unix_)
436// No way to implement this under FreeBSD. Just do nothing
437#else
438 #error unsupported platform
439#endif
440 return true;
441}
442
443bool TFileHandle::FallocateNoResize(i64 length) noexcept {
444 if (!IsOpen()) {

Callers 3

TTimerMethod · 0.45
ReserveMethod · 0.45
TGuardedStringStreamMethod · 0.45

Calls 1

GetLengthFunction · 0.50

Tested by

no test coverage detected