diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-19 22:34:00 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-05-19 22:34:00 +0200 |
| commit | 421701a530f7f69d0148e0f9ccd45b31b0801d6d (patch) | |
| tree | f85199c897ad5942d25a6a4edb88c9b238797be2 /zenserver/cache/structuredcachestore.cpp | |
| parent | Merge pull request #100 from EpicGames/de/fix-retry-logic-for-standalone-cach... (diff) | |
| parent | fix tests (diff) | |
| download | zen-421701a530f7f69d0148e0f9ccd45b31b0801d6d.tar.xz zen-421701a530f7f69d0148e0f9ccd45b31b0801d6d.zip | |
Merge pull request #99 from EpicGames/de/move-namespace-field
Keep Namespace out of CacheKey and store it on request level
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index 4edc13b4a..da948fd72 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -2128,6 +2128,8 @@ ZenCacheDiskLayer::TotalSize() const //////////////////////////// ZenCacheStore +static constexpr std::string_view UE4DDCNamespaceName = "ue4.ddc"; + ZenCacheStore::ZenCacheStore(CasGc& Gc, std::filesystem::path BasePath) : GcStorage(Gc), GcContributor(Gc) { CreateDirectories(BasePath); @@ -2150,11 +2152,13 @@ ZenCacheStore::ZenCacheStore(CasGc& Gc, std::filesystem::path BasePath) : GcStor ZEN_INFO("Found #{} namespaces in '{}' and #{} legacy buckets", Namespaces.size(), BasePath, LegacyBuckets.size()); - if (std::find(Namespaces.begin(), Namespaces.end(), DefaultNamespace) == Namespaces.end()) + if (std::find(Namespaces.begin(), Namespaces.end(), UE4DDCNamespaceName) == Namespaces.end()) { - ZEN_INFO("Moving #{} legacy buckets to anonymous namespace", LegacyBuckets.size()); + // default (unspecified) and ue4-ddc namespace points to the same namespace instance + + ZEN_INFO("Moving #{} legacy buckets to '{}' namespace", LegacyBuckets.size(), UE4DDCNamespaceName); - std::filesystem::path DefaultNamespaceFolder = BasePath / fmt::format("{}{}", NamespaceDiskPrefix, DefaultNamespace); + std::filesystem::path DefaultNamespaceFolder = BasePath / fmt::format("{}{}", NamespaceDiskPrefix, UE4DDCNamespaceName); CreateDirectories(DefaultNamespaceFolder); // Move any non-namespace folders into the default namespace folder @@ -2169,8 +2173,7 @@ ZenCacheStore::ZenCacheStore(CasGc& Gc, std::filesystem::path BasePath) : GcStor ZEN_ERROR("Unable to move '{}' to '{}', reason '{}'", LegacyFolder, NewPath, Ec.message()); } } - - Namespaces.push_back(std::string(DefaultNamespace)); + Namespaces.push_back(std::string(UE4DDCNamespaceName)); } for (const std::string& NamespaceName : Namespaces) @@ -2237,6 +2240,13 @@ ZenCacheStore::GetNamespace(std::string_view Namespace) { return It->second.get(); } + if (Namespace == DefaultNamespace) + { + if (auto It = m_Namespaces.find(std::string(UE4DDCNamespaceName)); It != m_Namespaces.end()) + { + return It->second.get(); + } + } return nullptr; } @@ -2249,6 +2259,10 @@ ZenCacheStore::IterateNamespaces(const std::function<void(std::string_view Names Namespaces.reserve(m_Namespaces.size()); for (const auto& Entry : m_Namespaces) { + if (Entry.first == DefaultNamespace) + { + continue; + } Namespaces.push_back({Entry.first, *Entry.second}); } } |