aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/buildstore/buildstore.cpp
blob: 81dffc09c7651268938eaab7dbbf4b90e231d787 (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
// Copyright Epic Games, Inc. All Rights Reserved.

#include "buildstore.h"

#include <zencore/testing.h>
#include <zencore/testutils.h>

#include <zencore/uid.h>
#include <zencore/xxhash.h>

namespace zen {

BuildStore::BuildStore(BuildStoreConfig Config)
{
	const uint64_t MaxBlockSize	 = 256 * 1024 * 1024;
	const uint64_t MaxBlockCount = 32 * 1024;
	m_BlockStore.Initialize(Config.RootDirectory, MaxBlockSize, MaxBlockCount);
}

BuildStore::~BuildStore()
{
}

// TODO: reconsider key size
inline Oid
IdFromKey(std::string_view Key)
{
	XXH3_128 Hash = XXH3_128::HashMemory(Key.data(), Key.size());

	Oid Id;
	memcpy(&Id.OidBits, Hash.Hash, sizeof Id);
	return Id;
}

void
BuildStore::Put(std::string_view Key, IoBuffer Value)
{
	ZEN_UNUSED(Key, Value);
}

IoBuffer
BuildStore::Get(std::string_view Key)
{
	ZEN_UNUSED(Key);
	return {};
}

/*
		___________              __
		\__    ___/___   _______/  |_  ______
		  |    |_/ __ \ /  ___/\   __\/  ___/
		  |    |\  ___/ \___ \  |  |  \___ \
		  |____| \___  >____  > |__| /____  >
					 \/     \/            \/
*/

#if ZEN_WITH_TESTS

TEST_CASE("BuildStore")
{
	ScopedTemporaryDirectory _;

	BuildStoreConfig Config;
	Config.RootDirectory = _.Path() / "build_store";
	BuildStore Store(Config);
}

void
buildstore_forcelink()
{
}

#endif

}  // namespace zen