aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/hub/hydration.h
blob: 19a96c2484e011636d026c18df87647cd5b1184e (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/compactbinary.h>

#include <filesystem>

namespace zen {

struct HydrationConfig
{
	// Location of server state to hydrate/dehydrate
	std::filesystem::path ServerStateDir;
	// Temporary directory available for use during hydration/dehydration
	std::filesystem::path TempDir;
	// Module ID of the server state being hydrated/dehydrated
	std::string ModuleId;
	// Back-end specific target specification (e.g. S3 bucket, file path, etc)
	std::string TargetSpecification;
	// Full config object when using --hub-hydration-target-config (mutually exclusive with TargetSpecification)
	CbObject Options;
};

/**
 * @brief State hydration strategy interface
 *
 * An instance of this interface is used to perform hydration OR
 * dehydration of server state. It's expected to be used only once
 * and not reused.
 *
 */
struct HydrationStrategyBase
{
	virtual ~HydrationStrategyBase() = default;

	virtual void Dehydrate()							  = 0;
	virtual void Hydrate()								  = 0;
	virtual void Configure(const HydrationConfig& Config) = 0;
};

std::unique_ptr<HydrationStrategyBase> CreateHydrator(const HydrationConfig& Config);

#if ZEN_WITH_TESTS
void hydration_forcelink();
#endif	// ZEN_WITH_TESTS

}  // namespace zen