ClickHouse/src/Storages/FileLog/FileLogBlockInputStream.h
2021-07-11 03:34:57 +00:00

49 lines
1.1 KiB
C++

#pragma once
#include <DataStreams/IBlockInputStream.h>
#include <Storages/FileLog/ReadBufferFromFileLog.h>
#include <Storages/FileLog/StorageFileLog.h>
namespace Poco
{
class Logger;
}
namespace DB
{
class FileLogBlockInputStream : public IBlockInputStream
{
public:
FileLogBlockInputStream(
StorageFileLog & storage_,
const StorageMetadataPtr & metadata_snapshot_,
const std::shared_ptr<Context> & context_,
const Names & columns,
size_t max_block_size_);
~FileLogBlockInputStream() override = default;
String getName() const override { return storage.getName(); }
Block getHeader() const override;
void readPrefixImpl() override;
Block readImpl() override;
void readSuffixImpl() override;
bool isStalled() { return !buffer || buffer->isStalled(); }
private:
StorageFileLog & storage;
StorageMetadataPtr metadata_snapshot;
ContextPtr context;
Names column_names;
UInt64 max_block_size;
ReadBufferFromFileLogPtr buffer;
const Block non_virtual_header;
const Block virtual_header;
};
}