blob: 661ef5d0b58f149ee78fdcb9f2afd671d063e281 (
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
|
#pragma once
#include <library/cpp/threading/future/core/future.h>
#include <yt/cpp/mapreduce/client/transaction.h>
#include <yt/cpp/mapreduce/common/fwd.h>
#include <yt/cpp/mapreduce/http/context.h>
#include <yt/cpp/mapreduce/interface/io.h>
#include <util/generic/size_literals.h>
namespace NYT::NPrivate {
////////////////////////////////////////////////////////////////////////////////
class TRetryfulWriterV2
: public TRawTableWriter
{
public:
TRetryfulWriterV2(
const IRawClientPtr& rawClient,
IClientRetryPolicyPtr clientRetryPolicy,
ITransactionPingerPtr transactionPinger,
const TClientContext& context,
const TTransactionId& parentId,
const TString& command,
const TMaybe<TFormat>& format,
const TRichYPath& path,
const TNode& serializedWriterOptions,
ssize_t bufferSize,
bool createTranasaction);
void NotifyRowEnd() override;
void Abort() override;
size_t GetBufferMemoryUsage() const override;
protected:
void DoWrite(const void* buf, size_t len) override;
void DoFinish() override;
void DoStartBatch();
private:
class TSentBuffer;
class TSender;
struct TSendTask;
const ssize_t BufferSize_;
const ssize_t SendStep_ = 64_KB;
ssize_t NextSizeToSend_;
THolder<TSender> Sender_;
THolder<TPingableTransaction> WriteTransaction_;
THolder<TSendTask> Current_;
THolder<TSendTask> Previous_;
};
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT::NPrivate
|