ClickHouse/src/Storages/FileLog/FileLogSource.h

51 lines
1.0 KiB
C++
Raw Normal View History

2021-06-09 02:03:36 +00:00
#pragma once
2021-09-04 17:04:35 +00:00
#include <Processors/Sources/SourceWithProgress.h>
2021-06-09 02:03:36 +00:00
#include <Storages/FileLog/ReadBufferFromFileLog.h>
#include <Storages/FileLog/StorageFileLog.h>
namespace Poco
{
class Logger;
}
namespace DB
{
2021-09-04 17:04:35 +00:00
class FileLogSource : public SourceWithProgress
2021-06-09 02:03:36 +00:00
{
public:
2021-09-04 17:04:35 +00:00
FileLogSource(
2021-06-09 02:03:36 +00:00
StorageFileLog & storage_,
const StorageMetadataPtr & metadata_snapshot_,
2021-09-04 17:04:35 +00:00
const ContextPtr & context_,
2021-06-09 02:03:36 +00:00
const Names & columns,
2021-09-04 17:04:35 +00:00
size_t max_block_size_,
size_t poll_time_out_,
size_t stream_number_,
size_t max_streams_number_);
2021-06-09 02:03:36 +00:00
2021-09-05 06:32:32 +00:00
String getName() const override { return "FileLog"; }
bool noRecords() { return !buffer || buffer->noRecords(); }
2021-07-04 06:16:40 +00:00
2021-09-04 17:04:35 +00:00
protected:
Chunk generate() override;
2021-06-09 02:03:36 +00:00
private:
StorageFileLog & storage;
StorageMetadataPtr metadata_snapshot;
ContextPtr context;
Names column_names;
UInt64 max_block_size;
2021-09-04 17:04:35 +00:00
size_t poll_time_out;
2021-09-05 06:32:32 +00:00
std::unique_ptr<ReadBufferFromFileLog> buffer;
2021-06-09 02:03:36 +00:00
2021-09-05 11:41:13 +00:00
Block non_virtual_header;
const NamesAndTypesList column_names_and_types;
2021-06-09 02:03:36 +00:00
};
}