aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/WriteBufferFromFileDecorator.h
blob: 5344bb1425c849d5442aec80c7ba78e5e468601b (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
#pragma once

#include <IO/WriteBufferFromFileBase.h>

namespace DB
{

/// Delegates all writes to underlying buffer. Doesn't have own memory.
class WriteBufferFromFileDecorator : public WriteBufferFromFileBase
{
public:
    explicit WriteBufferFromFileDecorator(std::unique_ptr<WriteBuffer> impl_);

    ~WriteBufferFromFileDecorator() override;

    void sync() override;

    std::string getFileName() const override;

    void preFinalize() override;

    const WriteBuffer & getImpl() const { return *impl; }

protected:
    void finalizeImpl() override;

    std::unique_ptr<WriteBuffer> impl;

private:
    void nextImpl() override;

    bool is_prefinalized = false;
};

}