aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/retryless_writer.cpp
blob: 4c25c1a1dde447c9c9ae55e810c97f7cc143c30b (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
#include "retryless_writer.h"

#include <yt/cpp/mapreduce/interface/logging/yt_log.h>

namespace NYT {

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

TRetrylessWriter::~TRetrylessWriter()
{
    NDetail::FinishOrDie(this, "TRetrylessWriter");
}

void TRetrylessWriter::DoFinish()
{
    if (!Running_) {
        return;
    }
    Running_ = false;

    BufferedOutput_->Finish();
    Request_->Finish()->GetResponse();
}

void TRetrylessWriter::DoWrite(const void* buf, size_t len)
{
    try {
        BufferedOutput_->Write(buf, len);
    } catch (...) {
        Running_ = false;
        throw;
    }
}

void TRetrylessWriter::NotifyRowEnd()
{ }

void TRetrylessWriter::Abort()
{
    Running_ = false;
}

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

} // namespace NYT