aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/io/job_reader.h
blob: c5f6cdffc2640d24127a52d8ffabfa921990e9ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once

#include <yt/cpp/mapreduce/interface/io.h>

#include <util/stream/buffered.h>
#include <util/stream/file.h>
#include <util/system/file.h>

namespace NYT {

////////////////////////////////////////////////////////////////////////////////

class TJobReader
    : public TRawTableReader
{
public:
    explicit TJobReader(int fd);
    explicit TJobReader(const TFile& file);

    bool Retry(
        const TMaybe<ui32>& rangeIndex,
        const TMaybe<ui64>& rowIndex,
        const std::exception_ptr& error) override;
    void ResetRetries() override;
    bool HasRangeIndices() const override;

protected:
    size_t DoRead(void* buf, size_t len) override;

private:
    TFile FdFile_;
    TUnbufferedFileInput FdInput_;
    TBufferedInput BufferedInput_;

    static const size_t BUFFER_SIZE = 64 << 10;
};

////////////////////////////////////////////////////////////////////////////////


} // namespace NYT