blob: c60ccfc1d44021bb86e1e5ea5d4c66cba8381f1d (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#pragma once
#include <yt/cpp/mapreduce/http/context.h>
#include <yt/cpp/mapreduce/http/helpers.h>
#include <yt/cpp/mapreduce/http/http.h>
#include <yt/cpp/mapreduce/http/http_client.h>
#include <yt/cpp/mapreduce/http/requests.h>
#include <yt/cpp/mapreduce/http_client/raw_requests.h>
#include <yt/cpp/mapreduce/interface/config.h>
#include <yt/cpp/mapreduce/interface/common.h>
#include <yt/cpp/mapreduce/interface/config.h>
#include <yt/cpp/mapreduce/interface/io.h>
#include <yt/cpp/mapreduce/interface/tvm.h>
#include <yt/cpp/mapreduce/io/helpers.h>
#include <util/stream/buffered.h>
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
class TRetrylessWriter
: public TRawTableWriter
{
public:
template <class TWriterOptions>
TRetrylessWriter(
const TClientContext& context,
const TTransactionId& parentId,
const TMaybe<TFormat>& format,
const TRichYPath& path,
size_t bufferSize,
const TWriterOptions& options)
: BufferSize_(bufferSize)
, AutoFinish_(options.AutoFinish_)
{
Output_ = NDetail::NRawClient::WriteTable(context, parentId, path, format, options);
}
~TRetrylessWriter() override;
void NotifyRowEnd() override;
void Abort() override;
size_t GetBufferMemoryUsage() const override;
protected:
void DoWrite(const void* buf, size_t len) override;
void DoFinish() override;
private:
const size_t BufferSize_ = 0;
const bool AutoFinish_;
bool Running_ = true;
std::unique_ptr<IOutputStream> Output_;
};
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
|