aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/ISink.h
blob: f960def1cdd9371116f27e2d39ded62f84d6937f (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
#pragma once

#include <Processors/IProcessor.h>


namespace DB
{

class ISink : public IProcessor
{
protected:
    InputPort & input;
    Chunk current_chunk;
    bool has_input = false;
    bool was_on_start_called = false;
    bool was_on_finish_called = false;

    virtual void consume(Chunk block) = 0;
    virtual void onStart() {}
    virtual void onFinish() {}

public:
    explicit ISink(Block header);

    Status prepare() override;
    void work() override;

    InputPort & getPort() { return input; }
};

}