diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-16 17:40:26 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-05-16 17:40:26 +0200 |
| commit | ca92318203f4a8e2b84d67dfd6a3e8ca40da4cd2 (patch) | |
| tree | 3c5462ab198a0c67549c94346e7809bfa4e331e3 /zenserver/cache/structuredcachestore.cpp | |
| parent | Merge pull request #97 from EpicGames/actions_tweaks (diff) | |
| parent | review feedback (diff) | |
| download | zen-ca92318203f4a8e2b84d67dfd6a3e8ca40da4cd2.tar.xz zen-ca92318203f4a8e2b84d67dfd6a3e8ca40da4cd2.zip | |
Merge pull request #94 from EpicGames/de/http-cache-api-with-namespaces
http cache uri API with namespaces
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index c21945702..16130a98b 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -2128,8 +2128,6 @@ ZenCacheDiskLayer::TotalSize() const //////////////////////////// ZenCacheStore -static constexpr std::string_view ZenCacheNamespaceDirPrefix = "ns_"; - ZenCacheStore::ZenCacheStore(CasGc& Gc, std::filesystem::path BasePath) : GcStorage(Gc), GcContributor(Gc) { CreateDirectories(BasePath); @@ -2142,9 +2140,9 @@ ZenCacheStore::ZenCacheStore(CasGc& Gc, std::filesystem::path BasePath) : GcStor for (const std::filesystem::path& DirPath : DirContent.Directories) { std::string DirName = PathToUtf8(DirPath.stem()); - if (DirName.starts_with(ZenCacheNamespaceDirPrefix)) + if (DirName.starts_with(NamespaceDiskPrefix)) { - Namespaces.push_back(DirName.substr(3)); + Namespaces.push_back(DirName.substr(NamespaceDiskPrefix.length())); continue; } LegacyBuckets.push_back(DirName); @@ -2155,7 +2153,8 @@ ZenCacheStore::ZenCacheStore(CasGc& Gc, std::filesystem::path BasePath) : GcStor if (std::find(Namespaces.begin(), Namespaces.end(), DefaultNamespace) == Namespaces.end()) { ZEN_INFO("Moving #{} legacy buckets to anonymous namespace", LegacyBuckets.size()); - std::filesystem::path DefaultNamespaceFolder = BasePath / fmt::format("{}{}", ZenCacheNamespaceDirPrefix, DefaultNamespace); + + std::filesystem::path DefaultNamespaceFolder = BasePath / fmt::format("{}{}", NamespaceDiskPrefix, DefaultNamespace); CreateDirectories(DefaultNamespaceFolder); // Move any non-namespace folders into the default namespace folder @@ -2170,13 +2169,14 @@ 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)); } for (const std::string& NamespaceName : Namespaces) { m_Namespaces[NamespaceName] = - std::make_unique<ZenCacheNamespace>(Gc, BasePath / fmt::format("{}{}", ZenCacheNamespaceDirPrefix, NamespaceName)); + std::make_unique<ZenCacheNamespace>(Gc, BasePath / fmt::format("{}{}", NamespaceDiskPrefix, NamespaceName)); } } @@ -2284,8 +2284,9 @@ ZenCacheStore::StorageSize() const ////////////////////////////////////////////////////////////////////////// +} // namespace zen + #if ZEN_WITH_TESTS -} namespace zen { |