aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenstore/cache/structuredcachestore.cpp')
-rw-r--r--src/zenstore/cache/structuredcachestore.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/zenstore/cache/structuredcachestore.cpp b/src/zenstore/cache/structuredcachestore.cpp
index cff0e9a35..990238e1e 100644
--- a/src/zenstore/cache/structuredcachestore.cpp
+++ b/src/zenstore/cache/structuredcachestore.cpp
@@ -468,7 +468,7 @@ ZenCacheStore::LogWorker()
LoggerRef ZCacheLog(logging::Get("z$"));
- auto Log = [&ZCacheLog]() -> LoggerRef { return ZCacheLog; };
+ ZEN_SCOPED_LOG(ZCacheLog);
std::vector<AccessLogItem> Items;
while (true)
@@ -817,7 +817,7 @@ ZenCacheStore::DropNamespace(std::string_view InNamespace)
std::function<void()> PostDropOp;
{
RwLock::ExclusiveLockScope _(m_NamespacesLock);
- if (auto It = m_Namespaces.find(std::string(InNamespace)); It != m_Namespaces.end())
+ if (auto It = m_Namespaces.find(InNamespace); It != m_Namespaces.end())
{
ZenCacheNamespace& Namespace = *It->second;
m_DroppedNamespaces.push_back(std::move(It->second));
@@ -888,13 +888,13 @@ ZenCacheNamespace*
ZenCacheStore::GetNamespace(std::string_view Namespace)
{
RwLock::SharedLockScope _(m_NamespacesLock);
- if (auto It = m_Namespaces.find(std::string(Namespace)); It != m_Namespaces.end())
+ if (auto It = m_Namespaces.find(Namespace); It != m_Namespaces.end())
{
return It->second.get();
}
if (Namespace == DefaultNamespace)
{
- if (auto It = m_Namespaces.find(std::string(UE4DDCNamespaceName)); It != m_Namespaces.end())
+ if (auto It = m_Namespaces.find(UE4DDCNamespaceName); It != m_Namespaces.end())
{
return It->second.get();
}
@@ -907,17 +907,17 @@ ZenCacheStore::GetNamespace(std::string_view Namespace)
}
RwLock::ExclusiveLockScope __(m_NamespacesLock);
- if (auto It = m_Namespaces.find(std::string(Namespace)); It != m_Namespaces.end())
+ if (auto It = m_Namespaces.find(Namespace); It != m_Namespaces.end())
{
return It->second.get();
}
auto NewNamespace =
- m_Namespaces.insert_or_assign(std::string(Namespace),
- std::make_unique<ZenCacheNamespace>(m_Gc,
- m_JobQueue,
- m_BasePath / fmt::format("{}{}", NamespaceDiskPrefix, Namespace),
- m_Configuration.NamespaceConfig));
+ m_Namespaces.try_emplace(std::string(Namespace),
+ std::make_unique<ZenCacheNamespace>(m_Gc,
+ m_JobQueue,
+ m_BasePath / fmt::format("{}{}", NamespaceDiskPrefix, Namespace),
+ m_Configuration.NamespaceConfig));
if (m_CapturedNamespaces)
{
@@ -931,13 +931,13 @@ const ZenCacheNamespace*
ZenCacheStore::FindNamespace(std::string_view Namespace) const
{
RwLock::SharedLockScope _(m_NamespacesLock);
- if (auto It = m_Namespaces.find(std::string(Namespace)); It != m_Namespaces.end())
+ if (auto It = m_Namespaces.find(Namespace); It != m_Namespaces.end())
{
return It->second.get();
}
if (Namespace == DefaultNamespace)
{
- if (auto It = m_Namespaces.find(std::string(UE4DDCNamespaceName)); It != m_Namespaces.end())
+ if (auto It = m_Namespaces.find(UE4DDCNamespaceName); It != m_Namespaces.end())
{
return It->second.get();
}
@@ -1086,11 +1086,9 @@ ZenCacheStore::GetBucketInfo(std::string_view NamespaceName, std::string_view Bu
std::vector<RwLock::SharedLockScope>
ZenCacheStore::LockState(GcCtx& Ctx)
{
+ ZEN_UNUSED(Ctx);
ZEN_TRACE_CPU("CacheStore::LockState");
- auto Log = [&Ctx]() { return Ctx.Logger; };
- ZEN_UNUSED(Log);
-
std::vector<RwLock::SharedLockScope> Locks;
Locks.emplace_back(RwLock::SharedLockScope(m_NamespacesLock));
for (auto& NamespaceIt : m_Namespaces)
@@ -1211,7 +1209,7 @@ public:
{
ZEN_TRACE_CPU("Z$::UpdateLockedState");
- auto Log = [&Ctx]() { return Ctx.Logger; };
+ ZEN_SCOPED_LOG(Ctx.Logger);
Stopwatch Timer;
@@ -1276,7 +1274,7 @@ public:
{
ZEN_TRACE_CPU("Z$::GetUnusedReferences");
- auto Log = [&Ctx]() { return Ctx.Logger; };
+ ZEN_SCOPED_LOG(Ctx.Logger);
const size_t InitialCount = IoCids.size();
size_t UsedCount = InitialCount;
@@ -1309,7 +1307,7 @@ ZenCacheStore::CreateReferenceCheckers(GcCtx& Ctx)
{
ZEN_TRACE_CPU("CacheStore::CreateReferenceCheckers");
- auto Log = [&Ctx]() { return Ctx.Logger; };
+ ZEN_SCOPED_LOG(Ctx.Logger);
Stopwatch Timer;
const auto _ = MakeGuard([&] {