ClickHouse/src/Storages/RabbitMQ/RabbitMQBlockInputStream.h
2020-07-02 19:44:04 +03:00

43 lines
1023 B
C++

#pragma once
#include <DataStreams/IBlockInputStream.h>
#include <Interpreters/Context.h>
#include <Storages/RabbitMQ/StorageRabbitMQ.h>
#include <Storages/RabbitMQ/ReadBufferFromRabbitMQConsumer.h>
namespace DB
{
class RabbitMQBlockInputStream : public IBlockInputStream
{
public:
RabbitMQBlockInputStream(
StorageRabbitMQ & storage_,
const StorageMetadataPtr & metadata_snapshot_,
const Context & context_,
const Names & columns,
Poco::Logger * log_);
~RabbitMQBlockInputStream() override;
String getName() const override { return storage.getName(); }
Block getHeader() const override;
void readPrefixImpl() override;
Block readImpl() override;
private:
StorageRabbitMQ & storage;
StorageMetadataPtr metadata_snapshot;
Context context;
Names column_names;
Poco::Logger * log;
bool finished = false, claimed = false;
const Block non_virtual_header, virtual_header;
ConsumerBufferPtr buffer;
};
}