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

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

namespace NYT {

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

TRetrylessWriter::~TRetrylessWriter()
{
    NDetail::FinishOrDie(this, AutoFinish_, "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;
}

size_t TRetrylessWriter::GetBufferMemoryUsage() const
{
    return BufferSize_;
}

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

} // namespace NYT