2018-05-23 20:19:33 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Processors/IProcessor.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ISink : public IProcessor
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
InputPort & input;
|
2019-02-18 16:36:07 +00:00
|
|
|
Chunk current_chunk;
|
2019-03-01 14:41:12 +00:00
|
|
|
bool has_input = false;
|
2021-07-26 14:47:29 +00:00
|
|
|
bool was_on_start_called = false;
|
2021-07-23 14:25:35 +00:00
|
|
|
bool was_on_finish_called = false;
|
2018-05-23 20:19:33 +00:00
|
|
|
|
2019-02-18 16:36:07 +00:00
|
|
|
virtual void consume(Chunk block) = 0;
|
2021-07-26 14:47:29 +00:00
|
|
|
virtual void onStart() {}
|
2020-02-19 15:09:32 +00:00
|
|
|
virtual void onFinish() {}
|
|
|
|
|
2018-05-23 20:19:33 +00:00
|
|
|
public:
|
2019-07-07 14:57:50 +00:00
|
|
|
explicit ISink(Block header);
|
2018-05-23 20:19:33 +00:00
|
|
|
|
|
|
|
Status prepare() override;
|
|
|
|
void work() override;
|
|
|
|
|
|
|
|
InputPort & getPort() { return input; }
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|