forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWaitForAsyncInsertSource.h
More file actions
38 lines (31 loc) · 877 Bytes
/
Copy pathWaitForAsyncInsertSource.h
File metadata and controls
38 lines (31 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include <Processors/ISource.h>
#include <Interpreters/AsynchronousInsertQueue.h>
namespace DB
{
/// Source, that allow to wait until processing of
/// asynchronous insert for specified query_id will be finished.
class WaitForAsyncInsertSource : public ISource, WithContext
{
public:
WaitForAsyncInsertSource(
const String & query_id_, size_t timeout_ms_, AsynchronousInsertQueue & queue_)
: ISource(Block())
, query_id(query_id_)
, timeout_ms(timeout_ms_)
, queue(queue_)
{
}
String getName() const override { return "WaitForAsyncInsert"; }
protected:
Chunk generate() override
{
queue.waitForProcessingQuery(query_id, std::chrono::milliseconds(timeout_ms));
return Chunk();
}
private:
String query_id;
size_t timeout_ms;
AsynchronousInsertQueue & queue;
};
}