aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/client_writer.h
blob: 19a49778172a463f9e2e9c49807cddb1c5eecd0c (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
42
43
44
45
46
47
#pragma once

#include <yt/cpp/mapreduce/common/fwd.h>

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

namespace NYT {

struct TTableWriterOptions;

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

class TClientWriter
    : public IProxyOutput
{
public:
    TClientWriter(
        const TRichYPath& path,
        IClientRetryPolicyPtr clientRetryPolicy,
        ITransactionPingerPtr transactionPinger,
        const TClientContext& context,
        const TTransactionId& transactionId,
        const TMaybe<TFormat>& format,
        const TTableWriterOptions& options);

    ~TClientWriter();

    size_t GetStreamCount() const override;
    IOutputStream* GetStream(size_t tableIndex) const override;
    void OnRowFinished(size_t tableIndex) override;
    void Abort() override;
    size_t GetBufferMemoryUsage() const override;

    void Finish();

private:
    const size_t BufferSize_ = 64 << 20;
    const bool AutoFinish_;

    ::TIntrusivePtr<TRawTableWriter> RawWriter_;
};

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


} // namespace NYT