blob: e0809f2b4213d42e274577257b07854750561f99 (
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
|
#pragma once
#include <yt/cpp/mapreduce/interface/io.h>
#include <library/cpp/yson/public.h>
namespace NYT {
class IProxyOutput;
class IOutputStreamWithResponse;
////////////////////////////////////////////////////////////////////////////////
class TNodeTableWriter
: public INodeWriterImpl
{
public:
explicit TNodeTableWriter(THolder<IProxyOutput> output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Binary);
~TNodeTableWriter() override;
void AddRow(const TNode& row, size_t tableIndex) override;
void AddRow(TNode&& row, size_t tableIndex) override;
size_t GetBufferMemoryUsage() const override;
size_t GetTableCount() const override;
void FinishTable(size_t) override;
void Abort() override;
private:
std::unique_ptr<IProxyOutput> Output_;
TVector<std::unique_ptr<::NYson::TYsonWriter>> Writers_;
};
////////////////////////////////////////////////////////////////////////////////
class TNodeTableFragmentWriter
: public ITableFragmentWriter<TNode>
{
public:
explicit TNodeTableFragmentWriter(std::unique_ptr<IOutputStreamWithResponse> output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Binary);
TWriteTableFragmentResult GetWriteFragmentResult() const override;
void AddRow(const TNode& row) override;
void Finish() override;
private:
std::unique_ptr<IOutputStreamWithResponse> Output_;
std::unique_ptr<::NYson::TYsonWriter> Writer_;
};
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
|