aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/file_writer.h
blob: ae143a75beecba5be2eded56fe3809d4e2c4b169 (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
#pragma once

#include "retryful_writer.h"

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

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

namespace NYT {

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

class TFileWriter
    : public IFileWriter
{
public:
    TFileWriter(
        const TRichYPath& path,
        IClientRetryPolicyPtr clientRetryPolicy,
        ITransactionPingerPtr transactionPinger,
        const TClientContext& context,
        const TTransactionId& transactionId,
        const TFileWriterOptions& options = TFileWriterOptions());

    ~TFileWriter() override;

protected:
    void DoWrite(const void* buf, size_t len) override;
    void DoFinish() override;
    size_t GetBufferMemoryUsage() const override;

private:
    const bool AutoFinish_;
    TRetryfulWriter RetryfulWriter_;
    static const size_t BUFFER_SIZE = 64 << 20;
};

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

} // namespace NYT