aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/io/counting_raw_reader.h
blob: c3b197d5844443fe5d1e0a33d0e3706d3bcfc8aa (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
#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,
        const std::exception_ptr& error) 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