Adding more features

This commit is contained in:
Ian Roddis
2021-06-05 00:19:09 -03:00
parent b7109dac93
commit 43cd8b46be
3 changed files with 50 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
#pragma once
#include <string>
/*
MetaStore represents the interface to store all the state information
for daggy to run. Abstracted in case other back-end solutions need to
be supported.
*/
namespace daggy {
using DAGDefID = int16_t; // future proofing
// This struct will contain transitions for
struct DAGRunEvent { };
class MetaStore {
// Basic storage + retrieval of DAG Definitions
virtual void storeDAGDefinition(std::string name, std::string definition) = 0;
virtual DAGDefID getCurrentDAGVersion(std::string name) = 0;
virtual std::string getDAGDefinition(std::string name, DAGDefID version = -1) = 0;
// DAG Run State
};
}

View File

@@ -9,8 +9,11 @@
namespace daggy {
class Scheduler {
public:
// Register an executor
void registerExecutor(std::shared_ptr<Executor> executor);
void runDAG(std::unordered_map<std::string, Task> tasks);
void runDAG(std::string dagJson);
private:
std::unordered_map<std::string, std::shared_ptr<Executor>> executors;
std::unordered_map<std::string, std::vector<std::future<TaskResult>>> jobs;

View File

@@ -15,11 +15,32 @@ namespace daggy {
{}
void init(int threads = 1);
void start();
private:
void createDescription();
//
// DAG Definition handlers
//
void listDAGs(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response);
void upsertDAG(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response);
void deleteDAG(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response);
void getDAG(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response);
//
// DAG Runs
//
void runDAG(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response);
// List
void getDAGRuns(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response);
// Get status of specific run
void getDAGRun(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response);
Pistache::Http::Endpoint endpoint_;
Pistache::Rest::Description desc_;