34 lines
1.0 KiB
C++
34 lines
1.0 KiB
C++
#pragma once
|
|||
|
|
|
||
|
|
// Base of every service in this module: a Service that owns a VertexTarget
|
||
|
|
// and a CallPlanner, and runs planned calls over the shared GoogleClient.
|
||
|
|
|
||
|
|
#include <functional>
|
||
|
|
|
||
|
|
#include "google/models/json_read.h"
|
||
|
|
#include "google/models/planner.h"
|
||
|
|
#include "google/service.h"
|
||
|
|
|
||
|
|
namespace molo::google::models {
|
||
|
|
|
||
|
|
class VertexService : public Service {
|
||
|
|
public:
|
||
|
|
VertexService(std::shared_ptr<GoogleClient> client, VertexTarget target,
|
||
|
|
std::string name);
|
||
|
|
|
||
|
|
const VertexTarget& target() const { return planner_.target(); }
|
||
|
|
const CallPlanner& planner() const { return planner_; }
|
||
|
|
|
||
|
|
protected:
|
||
|
|
clients::body::Json run(const PlannedCall& call) const;
|
||
|
|
void run_stream(const PlannedCall& call,
|
||
|
|
const GoogleClient::EventSink& sink) const;
|
||
|
|
// Single "{publisher}/{model}" argument map.
|
||
|
|
static CallPlanner::Args model_args(const std::string& publisher,
|
||
|
|
const std::string& model);
|
||
|
|
|
||
|
|
CallPlanner planner_;
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace molo::google::models
|