MCPcopy Create free account
hub / github.com/XpuOS/xsched / Server

Method Server

service/server/src/server.cpp:17–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15using namespace xsched::protocol;
16
17Server::Server(const std::string &policy_name, const std::string &port)
18{
19 port_ = std::stoi(port);
20
21 XPolicyType type = GetPolicyType(policy_name);
22 if (type == kPolicyUnknown) XERRO("invalid policy name %s", policy_name.c_str());
23 XASSERT(type > kPolicyUnknown && type < kPolicyMax, "server policy must be a customized policy");
24
25 scheduler_ = std::make_unique<LocalScheduler>(type);
26 XINFO("scheduler created with policy %s", policy_name.c_str());
27
28 http_server_.Get("/xqueue/:handle", std::bind(&Server::GetXQueue, this,
29 std::placeholders::_1, std::placeholders::_2));
30 http_server_.Get("/xqueues", std::bind(&Server::GetXQueues, this,
31 std::placeholders::_1, std::placeholders::_2));
32 http_server_.Post("/config/:handle", std::bind(&Server::PostXQueueConfig, this,
33 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
34 http_server_.Get("/policy", std::bind(&Server::GetSchedulerPolicy, this,
35 std::placeholders::_1, std::placeholders::_2));
36 http_server_.Post("/policy", std::bind(&Server::PostSchedulerPolicy, this,
37 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
38 http_server_.Post("/hint", std::bind(&Server::PostHint, this,
39 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
40}
41
42Server::~Server()
43{

Callers

nothing calls this directly

Calls 2

GetPolicyTypeFunction · 0.85
GetMethod · 0.45

Tested by

no test coverage detected