summaryrefslogtreecommitdiffstats
path: root/include/framework/scheduling/Task.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/framework/scheduling/Task.h')
-rw-r--r--include/framework/scheduling/Task.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/include/framework/scheduling/Task.h b/include/framework/scheduling/Task.h
new file mode 100644
index 0000000..9e0655a
--- /dev/null
+++ b/include/framework/scheduling/Task.h
@@ -0,0 +1,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;
+
+}