ClickHouse/src/Storages/RabbitMQ/RabbitMQBlockInputStream.h

51 lines
1.1 KiB
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_,
2020-08-31 09:12:36 +00:00
Context & context_,
2020-08-28 08:52:02 +00:00
const Names & columns,
bool ack_in_suffix = true);
~RabbitMQBlockInputStream() override;
String getName() const override { return storage.getName(); }
Block getHeader() const override;
void readPrefixImpl() override;
Block readImpl() override;
2020-07-24 12:33:07 +00:00
void readSuffixImpl() override;
2020-08-28 08:52:02 +00:00
void updateChannel();
bool needManualChannelUpdate();
bool sendAck();
private:
StorageRabbitMQ & storage;
2020-06-24 17:32:57 +00:00
StorageMetadataPtr metadata_snapshot;
2020-08-31 09:12:36 +00:00
Context context;
Names column_names;
2020-08-28 08:52:02 +00:00
bool ack_in_suffix;
2020-07-13 01:11:35 +00:00
bool finished = false;
const Block non_virtual_header;
const Block virtual_header;
ConsumerBufferPtr buffer;
};
}