blob: 2c0bc0ae97516e15d0b12a7cba1a0251e9f91efb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// Copyright Epic Games, Inc. All Rights Reserved.
#include "computeservice.h"
#if ZEN_WITH_COMPUTE_SERVICES
# include <zencore/compactbinarybuilder.h>
# include <zencore/filesystem.h>
# include <zencore/fmtutils.h>
# include <zencore/logging.h>
# include <zencore/system.h>
# include <zenutil/zenserverprocess.h>
ZEN_THIRD_PARTY_INCLUDES_START
# include <EASTL/fixed_vector.h>
# include <asio.hpp>
ZEN_THIRD_PARTY_INCLUDES_END
# include <unordered_map>
namespace zen {
//////////////////////////////////////////////////////////////////////////
struct ResourceMetrics
{
uint64_t DiskUsageBytes = 0;
uint64_t MemoryUsageBytes = 0;
};
//////////////////////////////////////////////////////////////////////////
struct HttpComputeService::Impl
{
Impl(const Impl&) = delete;
Impl& operator=(const Impl&) = delete;
Impl();
~Impl();
void Initialize(std::filesystem::path BaseDir) { ZEN_UNUSED(BaseDir); }
void Cleanup() {}
private:
};
HttpComputeService::Impl::Impl()
{
}
HttpComputeService::Impl::~Impl()
{
}
///////////////////////////////////////////////////////////////////////////
HttpComputeService::HttpComputeService(std::filesystem::path BaseDir) : m_Impl(std::make_unique<Impl>())
{
using namespace std::literals;
m_Impl->Initialize(BaseDir);
m_Router.RegisterRoute(
"status",
[this](HttpRouterRequest& Req) {
CbObjectWriter Obj;
Obj.BeginArray("modules");
Obj.EndArray();
Req.ServerRequest().WriteResponse(HttpResponseCode::OK, Obj.Save());
},
HttpVerb::kGet);
m_Router.RegisterRoute(
"stats",
[this](HttpRouterRequest& Req) {
CbObjectWriter Obj;
Req.ServerRequest().WriteResponse(HttpResponseCode::OK, Obj.Save());
},
HttpVerb::kGet);
}
HttpComputeService::~HttpComputeService()
{
}
const char*
HttpComputeService::BaseUri() const
{
return "/compute/";
}
void
HttpComputeService::HandleRequest(zen::HttpServerRequest& Request)
{
m_Router.HandleRequest(Request);
}
} // namespace zen
#endif // ZEN_WITH_COMPUTE_SERVICES
|