mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
42 lines
981 B
C++
42 lines
981 B
C++
#pragma once
|
|
|
|
#include <DataStreams/IBlockInputStream.h>
|
|
#include <Interpreters/Context.h>
|
|
|
|
#include <Storages/Kafka/StorageKafka.h>
|
|
#include <Storages/Kafka/ReadBufferFromKafkaConsumer.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class KafkaBlockInputStream : public IBlockInputStream
|
|
{
|
|
public:
|
|
KafkaBlockInputStream(
|
|
StorageKafka & storage_, const Context & context_, const Names & columns, size_t max_block_size_, bool commit_in_suffix = true);
|
|
~KafkaBlockInputStream() override;
|
|
|
|
String getName() const override { return storage.getName(); }
|
|
Block getHeader() const override;
|
|
|
|
void readPrefixImpl() override;
|
|
Block readImpl() override;
|
|
void readSuffixImpl() override;
|
|
|
|
void commit();
|
|
|
|
private:
|
|
StorageKafka & storage;
|
|
Context context;
|
|
Names column_names;
|
|
UInt64 max_block_size;
|
|
|
|
ConsumerBufferPtr buffer;
|
|
bool broken = true, finished = false, claimed = false, commit_in_suffix;
|
|
|
|
const Block non_virtual_header, virtual_header;
|
|
};
|
|
|
|
}
|