ClickHouse/src/Storages/FileLog/FileLogSource.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.3 KiB
C++
Raw Normal View History

2021-06-09 02:03:36 +00:00
#pragma once
2022-05-20 19:49:31 +00:00
#include <Processors/ISource.h>
#include <Storages/FileLog/FileLogConsumer.h>
2021-06-09 02:03:36 +00:00
#include <Storages/FileLog/StorageFileLog.h>
namespace Poco
{
class Logger;
}
namespace DB
{
2022-05-20 19:49:31 +00:00
class FileLogSource : public ISource
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_,
StreamingHandleErrorMode handle_error_mode_);
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 !consumer || consumer->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;
StreamingHandleErrorMode handle_error_mode;
2021-09-27 04:39:50 +00:00
std::unique_ptr<FileLogConsumer> consumer;
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,
2022-02-28 00:15:37 +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
};
}