aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/io/job_reader.h
blob: ce62ec180f8826950283cb0f2fd5d767e905a971 (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
#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);

    virtual bool Retry( const TMaybe<ui32>& /*rangeIndex*/, const TMaybe<ui64>& /*rowIndex*/) override;
    virtual void ResetRetries() override;
    virtual 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