From 1274f92cf7ce890b7aa1fc9354503e2508c185eb Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 12 May 2022 13:48:45 +0200 Subject: Tests for HttpRequestParseRelativeUri --- zenserver/cache/structuredcachestore.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'zenserver/cache/structuredcachestore.cpp') diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index c21945702..5d1d39c50 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,7 +2140,7 @@ 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(NamespacePrefix)) { Namespaces.push_back(DirName.substr(3)); continue; @@ -2155,7 +2153,7 @@ 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("{}{}", NamespacePrefix, DefaultNamespace); CreateDirectories(DefaultNamespaceFolder); // Move any non-namespace folders into the default namespace folder @@ -2176,7 +2174,7 @@ ZenCacheStore::ZenCacheStore(CasGc& Gc, std::filesystem::path BasePath) : GcStor for (const std::string& NamespaceName : Namespaces) { m_Namespaces[NamespaceName] = - std::make_unique(Gc, BasePath / fmt::format("{}{}", ZenCacheNamespaceDirPrefix, NamespaceName)); + std::make_unique(Gc, BasePath / fmt::format("{}{}", NamespacePrefix, NamespaceName)); } } @@ -2284,8 +2282,9 @@ ZenCacheStore::StorageSize() const ////////////////////////////////////////////////////////////////////////// +} // namespace zen + #if ZEN_WITH_TESTS -} namespace zen { -- cgit v1.2.3 From 2f69a30c936bc475bf85daded3706dc67f2e8a0f Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 16 May 2022 13:10:10 +0200 Subject: use ns_ prefix on disk only --- zenserver/cache/structuredcachestore.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'zenserver/cache/structuredcachestore.cpp') diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index 5d1d39c50..16130a98b 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -2140,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(NamespacePrefix)) + if (DirName.starts_with(NamespaceDiskPrefix)) { - Namespaces.push_back(DirName.substr(3)); + Namespaces.push_back(DirName.substr(NamespaceDiskPrefix.length())); continue; } LegacyBuckets.push_back(DirName); @@ -2153,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("{}{}", NamespacePrefix, DefaultNamespace); + + std::filesystem::path DefaultNamespaceFolder = BasePath / fmt::format("{}{}", NamespaceDiskPrefix, DefaultNamespace); CreateDirectories(DefaultNamespaceFolder); // Move any non-namespace folders into the default namespace folder @@ -2168,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(Gc, BasePath / fmt::format("{}{}", NamespacePrefix, NamespaceName)); + std::make_unique(Gc, BasePath / fmt::format("{}{}", NamespaceDiskPrefix, NamespaceName)); } } -- cgit v1.2.3