ClickHouse/src/Storages/RabbitMQ/RabbitMQBlockInputStream.h

44 lines
992 B
C++
Raw Normal View History

#pragma once
#include <DataStreams/IBlockInputStream.h>
#include <Interpreters/Context.h>
#include <Storages/RabbitMQ/StorageRabbitMQ.h>
#include <Storages/RabbitMQ/ReadBufferFromRabbitMQConsumer.h>
namespace DB
{
2020-07-13 01:11:35 +00:00
class RabbitMQBlockInputStream : public IBlockInputStream
{
public:
RabbitMQBlockInputStream(
StorageRabbitMQ & storage_,
2020-06-24 17:32:57 +00:00
const StorageMetadataPtr & metadata_snapshot_,
const Context & context_,
2020-07-13 01:11:35 +00:00
const Names & columns);
~RabbitMQBlockInputStream() override;
String getName() const override { return storage.getName(); }
Block getHeader() const override;
void readPrefixImpl() override;
Block readImpl() override;
private:
StorageRabbitMQ & storage;
2020-06-24 17:32:57 +00:00
StorageMetadataPtr metadata_snapshot;
Context context;
Names column_names;
2020-07-13 01:11:35 +00:00
bool finished = false;
bool claimed = false;
const Block non_virtual_header;
const Block virtual_header;
ConsumerBufferPtr buffer;
};
}