aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/io/counting_raw_reader.h
blob: 3b6705c5e4531632c63cb9751942aa9595e91f6f (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
#pragma once

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

namespace NYT {
namespace NDetail {

class TCountingRawTableReader
    final : public TRawTableReader
{
public:
    TCountingRawTableReader(::TIntrusivePtr<TRawTableReader> reader)
        : Reader_(std::move(reader))
    { }

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

    size_t GetReadByteCount() const;

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

private:
    ::TIntrusivePtr<TRawTableReader> Reader_;
    size_t ReadByteCount_ = 0;
};

} // namespace NDetail
} // namespace NYT