diff options
| author | Stefan Boberg <[email protected]> | 2025-03-10 20:06:55 +0100 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2025-03-10 20:06:55 +0100 |
| commit | 306ec24dbc326f751337efac37f7d2a0fbd23e49 (patch) | |
| tree | 5cd57087321209a3fcd7be0f245e8d378b9a53c2 /src/zenserver | |
| parent | Fix problem in FinishInitializeLogging when not logging to file (diff) | |
| download | zen-306ec24dbc326f751337efac37f7d2a0fbd23e49.tar.xz zen-306ec24dbc326f751337efac37f7d2a0fbd23e49.zip | |
test stuff
Diffstat (limited to 'src/zenserver')
| -rw-r--r-- | src/zenserver/buildstore/buildstore.cpp | 72 | ||||
| -rw-r--r-- | src/zenserver/buildstore/buildstore.h | 30 | ||||
| -rw-r--r-- | src/zenserver/buildstore/httpbuildstore.cpp | 15 | ||||
| -rw-r--r-- | src/zenserver/buildstore/httpbuildstore.h | 11 | ||||
| -rw-r--r-- | src/zenserver/zenserver.cpp | 1 |
5 files changed, 107 insertions, 22 deletions
diff --git a/src/zenserver/buildstore/buildstore.cpp b/src/zenserver/buildstore/buildstore.cpp new file mode 100644 index 000000000..72c75dd68 --- /dev/null +++ b/src/zenserver/buildstore/buildstore.cpp @@ -0,0 +1,72 @@ +// 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) +{ +} + +IoBuffer +BuildStore::Get(std::string_view Key) +{ + return {}; +} + +/* + ___________ __ + \__ ___/___ _______/ |_ ______ + | |_/ __ \ / ___/\ __\/ ___/ + | |\ ___/ \___ \ | | \___ \ + |____| \___ >____ > |__| /____ > + \/ \/ \/ +*/ + +#if ZEN_WITH_TESTS + +TEST_CASE("BuildStore") +{ + ScopedTemporaryDirectory _; + + BuildStoreConfig Config; + Config.RootDirectory = _.Path() / "build_store"; + BuildStore Store(Config); +} + +void +buildstore_forcelink() +{ +} +} + +#endif diff --git a/src/zenserver/buildstore/buildstore.h b/src/zenserver/buildstore/buildstore.h new file mode 100644 index 000000000..b2801fc7f --- /dev/null +++ b/src/zenserver/buildstore/buildstore.h @@ -0,0 +1,30 @@ + +// Copyright Epic Games, Inc. All Rights Reserved. + +#include <zenstore/blockstore.h> + +#include <filesystem> + +namespace zen { + +struct BuildStoreConfig +{ + std::filesystem::path RootDirectory; +}; + +class BuildStore +{ +public: + BuildStore(BuildStoreConfig Config); + ~BuildStore(); + + void Put(std::string_view Key, IoBuffer Value); + IoBuffer Get(std::string_view Key); + +private: + BlockStore m_BlockStore; +}; + +void buildstore_forcelink(); + +} // namespace zen diff --git a/src/zenserver/buildstore/httpbuildstore.cpp b/src/zenserver/buildstore/httpbuildstore.cpp index f84e1fa57..1a0998c15 100644 --- a/src/zenserver/buildstore/httpbuildstore.cpp +++ b/src/zenserver/buildstore/httpbuildstore.cpp @@ -4,22 +4,9 @@ namespace zen { -struct HttpBuildStoreService::BuildStore -{ - BuildStore(std::filesystem::path RootDirectory) - { - const uint64_t MaxBlockSize = 256 * 1024 * 1024; - const uint64_t MaxBlockCount = 32 * 1024; - m_BlockStore.Initialize(RootDirectory, MaxBlockSize, MaxBlockCount); - } - -private: - BlockStore m_BlockStore; -}; - HttpBuildStoreService::HttpBuildStoreService(BuildStoreConfig Cfg) : m_Config(Cfg) { - m_BuildStore = std::make_unique<BuildStore>(m_Config.RootDirectory); + m_BuildStore = std::make_unique<BuildStore>(m_Config); } HttpBuildStoreService::~HttpBuildStoreService() diff --git a/src/zenserver/buildstore/httpbuildstore.h b/src/zenserver/buildstore/httpbuildstore.h index d16bbe5fe..d34035d0f 100644 --- a/src/zenserver/buildstore/httpbuildstore.h +++ b/src/zenserver/buildstore/httpbuildstore.h @@ -2,18 +2,14 @@ #pragma once +#include "buildstore.h" + #include <zenhttp/httpserver.h> -#include <filesystem> -#include <zenstore/blockstore.h> +#include <filesystem> namespace zen { -struct BuildStoreConfig -{ - std::filesystem::path RootDirectory; -}; - class HttpBuildStoreService final : public zen::HttpService { public: @@ -26,7 +22,6 @@ public: private: BuildStoreConfig m_Config; - struct BuildStore; std::unique_ptr<BuildStore> m_BuildStore; }; diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp index c12b1bac2..ace8229d7 100644 --- a/src/zenserver/zenserver.cpp +++ b/src/zenserver/zenserver.cpp @@ -1065,6 +1065,7 @@ void zenserver_forcelinktests() { zen::prj_forcelink(); + zen::buildstore_forcelink(); } #endif |