aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/io/node_table_writer.h
blob: 155bec076de72ea5877bce04debe3a781024f11f (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
#pragma once

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

namespace NYT {

class IProxyOutput;

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

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:
    THolder<IProxyOutput> Output_;
    TVector<THolder<::NYson::TYsonWriter>> Writers_;
};

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

} // namespace NYT