/* * include/framework/scheduling/Task.h * * Copyright (C) 2023 Douglas B. Rumbaugh * * Distributed under the Modified BSD License. * */ #pragma once #include #include #include "framework/util/Configuration.h" #include "framework/scheduling/Epoch.h" namespace de { template struct MergeArgs { Epoch *epoch; std::vector merges; std::promise result; bool compaction; void *extension; }; template struct QueryArgs { Epoch *epoch; std::promise> result_set; void *query_parms; }; typedef std::function Job; struct Task { Task(size_t size, size_t ts, Job job, void *args) : m_job(job) , m_size(size) , m_timestamp(ts) , m_args(args) {} Job m_job; size_t m_size; size_t m_timestamp; void *m_args; friend bool operator<(const Task &self, const Task &other) { return self.m_timestamp < other.m_timestamp; } friend bool operator>(const Task &self, const Task &other) { return self.m_timestamp > other.m_timestamp; } void operator()(size_t thrd_id) { m_job(m_args); } }; }