ClickHouse/src/Storages/Kafka/KafkaBlockInputStream.h

46 lines
1.1 KiB
C++
Raw Normal View History

#pragma once
2019-01-24 12:44:58 +00:00
#include <DataStreams/IBlockInputStream.h>
#include <Interpreters/Context.h>
#include <Storages/Kafka/StorageKafka.h>
2019-08-28 13:21:19 +00:00
#include <Storages/Kafka/ReadBufferFromKafkaConsumer.h>
namespace DB
{
2019-01-24 12:44:58 +00:00
class KafkaBlockInputStream : public IBlockInputStream
{
public:
KafkaBlockInputStream(
StorageKafka & storage_, const std::shared_ptr<Context> & context_, const Names & columns, size_t max_block_size_, bool commit_in_suffix = true);
~KafkaBlockInputStream() override;
String getName() const override { return storage.getName(); }
2019-05-22 19:38:43 +00:00
Block getHeader() const override;
void readPrefixImpl() override;
2019-05-22 19:38:43 +00:00
Block readImpl() override;
void readSuffixImpl() override;
void commit();
bool isStalled() const { return buffer->isStalled(); }
private:
StorageKafka & storage;
const std::shared_ptr<Context> context;
2019-05-22 19:38:43 +00:00
Names column_names;
2019-02-11 11:54:30 +00:00
UInt64 max_block_size;
ConsumerBufferPtr buffer;
bool broken = true;
bool finished = false;
bool commit_in_suffix;
const Block non_virtual_header;
const Block virtual_header;
};
}