aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/vfs/vfsservice.h
blob: 0d0168e23bccab3efd0b2fdfda8e4e59c8b9dec0 (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
// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include <zenbase/refcount.h>
#include <zenhttp/httpserver.h>
#include <zenhttp/httpstatus.h>
#include <zenvfs/vfs.h>

#include <memory>

namespace zen {

class ProjectStore;
class ZenCacheStore;

/** Virtual File System service

	Implements support for exposing data via a virtual file system interface. Currently
	this is primarily used to surface various data stored in the local storage service
	to users for debugging and exploration purposes.

	Currently, it surfaces information from the structured cache service and from the
	project store.

 */

class VfsService : public HttpService, public IHttpStatusProvider
{
public:
	explicit VfsService(HttpStatusService& StatusService);
	~VfsService();

	void Mount(std::string_view MountPoint);
	void Unmount();

	void AddService(Ref<ProjectStore>&&);
	void AddService(Ref<ZenCacheStore>&&);

protected:
	virtual const char* BaseUri() const override;
	virtual void		HandleRequest(HttpServerRequest& HttpServiceRequest) override;
	virtual void		HandleStatusRequest(HttpServerRequest& Request) override;

private:
	struct Impl;
	Impl* m_Impl = nullptr;

	HttpStatusService& m_StatusService;
	HttpRequestRouter  m_Router;

	friend struct VfsServiceDataSource;
};

}  // namespace zen