diff options
Diffstat (limited to 'zenserver')
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 24 | ||||
| -rw-r--r-- | zenserver/cache/structuredcachestore.h | 3 |
2 files changed, 21 insertions, 6 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index 6b7b73dcf..9218c2cbb 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}); } } diff --git a/zenserver/cache/structuredcachestore.h b/zenserver/cache/structuredcachestore.h index 232e8b9a8..34b8d18f4 100644 --- a/zenserver/cache/structuredcachestore.h +++ b/zenserver/cache/structuredcachestore.h @@ -356,7 +356,8 @@ private: class ZenCacheStore final : public GcStorage, public GcContributor { public: - static constexpr std::string_view DefaultNamespace = "default"; + static constexpr std::string_view DefaultNamespace = + "!default!"; // This is intentionally not a valid namespace name and will only be used for mapping when no namespace is given static constexpr std::string_view NamespaceDiskPrefix = "ns_"; ZenCacheStore(CasGc& Gc, std::filesystem::path BasePath); |