aboutsummaryrefslogtreecommitdiff
path: root/zenserver/testing/launch.h
blob: 6fd3e39ae0947b8d02e20b21de3ef3d343befbe6 (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
// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include <zencore/zencore.h>

#if !defined(ZEN_WITH_EXEC_SERVICES)
#	define ZEN_WITH_EXEC_SERVICES ZEN_PLATFORM_WINDOWS
#endif

#if ZEN_WITH_EXEC_SERVICES

#	include <zencore/logging.h>
#	include <zenhttp/httpserver.h>

#	include <filesystem>

namespace zen {

class CasStore;

/**
 * Process launcher for test executables
 */
class HttpLaunchService : public HttpService
{
public:
	HttpLaunchService(CasStore& Store, const std::filesystem::path& SandboxBaseDir);
	~HttpLaunchService();

	virtual const char* BaseUri() const override;
	virtual void		HandleRequest(HttpServerRequest& Request) override;

private:
	inline spdlog::logger& Log() { return m_Log; }

	spdlog::logger&		  m_Log;
	HttpRequestRouter	  m_Router;
	CasStore&			  m_CasStore;
	std::filesystem::path m_SandboxPath;
	std::atomic<int>	  m_SandboxCount{0};

	std::filesystem::path CreateNewSandbox();
};

}  // namespace zen

#endif	// ZEN_WITH_EXEC_SERVICES