blob: 9e0655a5bfbbc72d9c8355147942badc5b513502 (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*
*
*/
#pragma once
#include <variant>
#include "framework/util/Configuration.h"
namespace de {
enum class TaskType {
MERGE,
QUERY
};
struct MergeTask {
level_index m_source_level;
level_index m_target_level;
size_t m_timestamp;
size_t m_size;
TaskType m_type;
TaskType get_type() const {
return m_type;
}
friend bool operator<(const MergeTask &self, const MergeTask &other) {
return self.m_timestamp < other.m_timestamp;
}
friend bool operator>(const MergeTask &self, const MergeTask &other) {
return self.m_timestamp > other.m_timestamp;
}
};
struct QueryTask {
size_t m_timestamp;
size_t m_size;
TaskType m_type;
TaskType get_type() const {
return m_type;
}
friend bool operator<(const QueryTask &self, const QueryTask &other) {
return self.m_timestamp < other.m_timestamp;
}
friend bool operator>(const QueryTask &self, const QueryTask &other) {
return self.m_timestamp > other.m_timestamp;
}
};
struct GetTaskType {
TaskType operator()(const MergeTask &t) { return t.get_type(); }
TaskType operator()(const QueryTask &t) { return t.get_type(); }
};
typedef std::variant<MergeTask, QueryTask> Task;
}
|