2020-05-20 09:40:49 +00:00
|
|
|
#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
|
|
|
|
2020-05-20 09:40:49 +00:00
|
|
|
class RabbitMQBlockInputStream : public IBlockInputStream
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
RabbitMQBlockInputStream(
|
|
|
|
StorageRabbitMQ & storage_,
|
2020-06-24 17:32:57 +00:00
|
|
|
const StorageMetadataPtr & metadata_snapshot_,
|
2020-05-20 09:40:49 +00:00
|
|
|
const Context & context_,
|
2020-07-13 01:11:35 +00:00
|
|
|
const Names & columns);
|
2020-05-20 09:40:49 +00:00
|
|
|
|
|
|
|
~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;
|
2020-05-20 09:40:49 +00:00
|
|
|
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;
|
2020-05-20 09:40:49 +00:00
|
|
|
|
|
|
|
ConsumerBufferPtr buffer;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|