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

Method TDirectIOBufferedFile

util/system/direct_io.cpp:49–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47} // namespace
48
49TDirectIOBufferedFile::TDirectIOBufferedFile(const TString& path, EOpenMode oMode, size_t buflen /*= 1 << 17*/)
50 : File(path, oMode)
51 , Alignment(0)
52 , DataLen(0)
53 , ReadPosition(0)
54 , WritePosition(0)
55 , DirectIO(false)
56{
57 if (buflen == 0) {
58 ythrow TFileError() << "unbuffered usage is not supported";
59 }
60
61 if (oMode & Direct) {
62 Alignment = Singleton<TAlignmentCalcer>()->Alignment;
63 SetDirectIO(true);
64 }
65
66 WritePosition = File.GetLength();
67 FlushedBytes = WritePosition;
68 FlushedToDisk = FlushedBytes;
69 BufLen = (!!Alignment) ? AlignUp(buflen, Alignment) : buflen;
70 BufferStorage.Resize(BufLen + Alignment);
71 Buffer = (!!Alignment) ? AlignUp(BufferStorage.Data(), Alignment) : BufferStorage.Data();
72}
73
74#define DIRECT_IO_FLAGS (O_DIRECT | O_SYNC)
75

Callers

nothing calls this directly

Calls 4

AlignUpFunction · 0.70
GetLengthMethod · 0.45
ResizeMethod · 0.45
DataMethod · 0.45

Tested by

no test coverage detected