aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.h
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-20 12:08:44 +0200
committerStefan Boberg <[email protected]>2021-09-20 12:08:44 +0200
commit782351959f697fca6b0804c134467b7d9c29da1a (patch)
treefdd6c841a567e69e3d0b45089de70c7e7d0bb756 /zenserver/cache/structuredcachestore.h
parenttrivial: include cleanup (diff)
downloadzen-782351959f697fca6b0804c134467b7d9c29da1a.tar.xz
zen-782351959f697fca6b0804c134467b7d9c29da1a.zip
Moved more code into zen namespace, for consistency
Also removed snapshot_manifest (remnants of vfs prototype)
Diffstat (limited to 'zenserver/cache/structuredcachestore.h')
-rw-r--r--zenserver/cache/structuredcachestore.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/zenserver/cache/structuredcachestore.h b/zenserver/cache/structuredcachestore.h
index 48c3cfde9..c4fa20958 100644
--- a/zenserver/cache/structuredcachestore.h
+++ b/zenserver/cache/structuredcachestore.h
@@ -23,8 +23,6 @@ namespace zen {
class WideStringBuilderBase;
class CasStore;
-} // namespace zen
-
/******************************************************************************
/$$$$$$$$ /$$$$$$ /$$
@@ -44,8 +42,8 @@ class CasStore;
struct ZenCacheValue
{
- zen::IoBuffer Value;
- zen::CbObject IndexData;
+ IoBuffer Value;
+ CbObject IndexData;
};
class ZenCacheMemoryLayer
@@ -54,32 +52,32 @@ public:
ZenCacheMemoryLayer();
~ZenCacheMemoryLayer();
- bool Get(std::string_view Bucket, const zen::IoHash& HashKey, ZenCacheValue& OutValue);
- void Put(std::string_view Bucket, const zen::IoHash& HashKey, const ZenCacheValue& Value);
+ bool Get(std::string_view Bucket, const IoHash& HashKey, ZenCacheValue& OutValue);
+ void Put(std::string_view Bucket, const IoHash& HashKey, const ZenCacheValue& Value);
bool DropBucket(std::string_view Bucket);
private:
struct CacheBucket
{
- zen::RwLock m_bucketLock;
- tsl::robin_map<zen::IoHash, zen::IoBuffer> m_cacheMap;
+ RwLock m_bucketLock;
+ tsl::robin_map<IoHash, IoBuffer> m_cacheMap;
- bool Get(const zen::IoHash& HashKey, ZenCacheValue& OutValue);
- void Put(const zen::IoHash& HashKey, const ZenCacheValue& Value);
+ bool Get(const IoHash& HashKey, ZenCacheValue& OutValue);
+ void Put(const IoHash& HashKey, const ZenCacheValue& Value);
};
- zen::RwLock m_Lock;
+ RwLock m_Lock;
std::unordered_map<std::string, CacheBucket> m_Buckets;
};
class ZenCacheDiskLayer
{
public:
- ZenCacheDiskLayer(zen::CasStore& Cas, const std::filesystem::path& RootDir);
+ ZenCacheDiskLayer(CasStore& Cas, const std::filesystem::path& RootDir);
~ZenCacheDiskLayer();
- bool Get(std::string_view Bucket, const zen::IoHash& HashKey, ZenCacheValue& OutValue);
- void Put(std::string_view Bucket, const zen::IoHash& HashKey, const ZenCacheValue& Value);
+ bool Get(std::string_view Bucket, const IoHash& HashKey, ZenCacheValue& OutValue);
+ void Put(std::string_view Bucket, const IoHash& HashKey, const ZenCacheValue& Value);
bool DropBucket(std::string_view Bucket);
void Flush();
@@ -89,20 +87,20 @@ private:
*/
struct CacheBucket;
- zen::CasStore& m_CasStore;
+ CasStore& m_CasStore;
std::filesystem::path m_RootDir;
- zen::RwLock m_Lock;
+ RwLock m_Lock;
std::unordered_map<std::string, CacheBucket> m_Buckets; // TODO: make this case insensitive
};
class ZenCacheStore
{
public:
- ZenCacheStore(zen::CasStore& Cas, const std::filesystem::path& RootDir);
+ ZenCacheStore(CasStore& Cas, const std::filesystem::path& RootDir);
~ZenCacheStore();
- bool Get(std::string_view Bucket, const zen::IoHash& HashKey, ZenCacheValue& OutValue);
- void Put(std::string_view Bucket, const zen::IoHash& HashKey, const ZenCacheValue& Value);
+ bool Get(std::string_view Bucket, const IoHash& HashKey, ZenCacheValue& OutValue);
+ void Put(std::string_view Bucket, const IoHash& HashKey, const ZenCacheValue& Value);
bool DropBucket(std::string_view Bucket);
void Flush();
@@ -121,8 +119,10 @@ public:
ZenCacheTracker(ZenCacheStore& CacheStore);
~ZenCacheTracker();
- void TrackAccess(std::string_view Bucket, const zen::IoHash& HashKey);
+ void TrackAccess(std::string_view Bucket, const IoHash& HashKey);
void Flush();
private:
};
+
+} // namespace zen