77 lines
2.2 KiB
C++
77 lines
2.2 KiB
C++
#pragma once
|
|
|
|
// HTTP REST client for sqlite_api /api/datafactory/* endpoints.
|
|
// All calls are blocking; return false on net failure or non-2xx.
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace data_factory {
|
|
|
|
struct Node {
|
|
std::string id;
|
|
std::string kind; // extractor|transformer|database|sink|validator
|
|
std::string name;
|
|
std::string function_id;
|
|
std::string description;
|
|
std::string schedule_cron;
|
|
bool enabled = true;
|
|
std::vector<std::string> tags;
|
|
std::string created_at;
|
|
std::string updated_at;
|
|
};
|
|
|
|
struct Run {
|
|
std::string id;
|
|
std::string node_id;
|
|
std::string started_at;
|
|
std::string finished_at;
|
|
std::string status; // running|success|failed|cancelled
|
|
long long rows_in = 0;
|
|
long long rows_out = 0;
|
|
long long kb_in = 0;
|
|
long long kb_out = 0;
|
|
long long duration_ms = 0;
|
|
std::string trigger;
|
|
std::string error;
|
|
};
|
|
|
|
struct DatabaseInfo {
|
|
std::string id;
|
|
std::string kind;
|
|
std::string label;
|
|
std::string uri;
|
|
std::string description;
|
|
long long table_count = 0;
|
|
long long size_bytes = 0;
|
|
std::string last_seen_at;
|
|
};
|
|
|
|
// Mirrors dag_engine_ui FnInfo (response shape of GET /api/functions/{id}).
|
|
struct FnInfo {
|
|
std::string id;
|
|
std::string name;
|
|
std::string description;
|
|
std::string signature;
|
|
std::string purity;
|
|
std::string domain;
|
|
std::string lang;
|
|
std::vector<std::string> uses_functions;
|
|
std::vector<std::string> uses_types;
|
|
};
|
|
|
|
bool list_nodes_http(const std::string& api_url, const std::string& kind,
|
|
std::vector<Node>& out);
|
|
|
|
bool list_runs_http(const std::string& api_url, const std::string& node_id,
|
|
int limit, std::vector<Run>& out);
|
|
|
|
bool list_databases_http(const std::string& api_url,
|
|
std::vector<DatabaseInfo>& out);
|
|
|
|
bool get_function_http(const std::string& api_url,
|
|
const std::string& function_id,
|
|
FnInfo& out);
|
|
|
|
} // namespace data_factory
|