ClickHouse/src/Storages/FileLog/FileLogSource.h

61 lines
1.3 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 StorageSnapshotPtr & storage_snapshot_,
2021-09-04 17:04:35 +00:00
const ContextPtr & context_,
2021-09-30 16:02:17 +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-10-05 13:28:45 +00:00
void onFinish();
2021-09-27 04:39:50 +00:00
2021-10-22 02:36:24 +00:00
virtual ~FileLogSource() override;
2021-10-06 08:08:49 +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;
StorageSnapshotPtr storage_snapshot;
2021-06-09 02:03:36 +00:00
ContextPtr context;
2021-09-30 16:02:17 +00:00
Names column_names;
2021-06-09 02:03:36 +00:00
UInt64 max_block_size;
2021-09-04 17:04:35 +00:00
size_t poll_time_out;
2021-09-27 04:39:50 +00:00
size_t stream_number;
size_t max_streams_number;
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;
2021-09-24 16:44:22 +00:00
Block virtual_header;
2021-10-06 08:08:49 +00:00
/// The start pos and end pos of files responsible by this stream,
2021-10-17 14:49:27 +00:00
/// does not include end
2021-10-06 10:37:58 +00:00
size_t start;
size_t end;
2021-06-09 02:03:36 +00:00
};
}