aboutsummaryrefslogtreecommitdiff
path: root/zenutil/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-05-06 16:42:27 +0200
committerDan Engelbrecht <[email protected]>2022-05-11 16:13:36 +0200
commit33fa76a35a96cad1865854068e60c1ca0b53864e (patch)
treeeaf79c48e277286270ac3862ec6897b4bfab4fba /zenutil/include
parentMerge pull request #92 from EpicGames/de/bucket-standalone-temp-file-cleanup (diff)
downloadzen-33fa76a35a96cad1865854068e60c1ca0b53864e.tar.xz
zen-33fa76a35a96cad1865854068e60c1ca0b53864e.zip
parameterize namespace for upstream (first hack)
Diffstat (limited to 'zenutil/include')
-rw-r--r--zenutil/include/zenutil/cache/cachekey.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/zenutil/include/zenutil/cache/cachekey.h b/zenutil/include/zenutil/cache/cachekey.h
index aa649b4dc..e6110a522 100644
--- a/zenutil/include/zenutil/cache/cachekey.h
+++ b/zenutil/include/zenutil/cache/cachekey.h
@@ -12,10 +12,14 @@ namespace zen {
struct CacheKey
{
+ std::string Namespace;
std::string Bucket;
IoHash Hash;
- static CacheKey Create(std::string_view Bucket, const IoHash& Hash) { return {.Bucket = ToLower(Bucket), .Hash = Hash}; }
+ static CacheKey Create(std::string_view Namespace, std::string_view Bucket, const IoHash& Hash)
+ {
+ return {.Namespace = ToLower(Namespace), .Bucket = ToLower(Bucket), .Hash = Hash};
+ }
static const CacheKey Empty;
};
@@ -23,21 +27,23 @@ struct CacheKey
inline bool
operator==(const CacheKey& A, const CacheKey& B)
{
- return A.Bucket == B.Bucket && A.Hash == B.Hash;
+ return A.Namespace == B.Namespace && A.Bucket == B.Bucket && A.Hash == B.Hash;
}
inline bool
operator!=(const CacheKey& A, const CacheKey& B)
{
- return A.Bucket != B.Bucket || A.Hash != B.Hash;
+ return A.Namespace != B.Namespace || A.Bucket != B.Bucket || A.Hash != B.Hash;
}
inline bool
operator<(const CacheKey& A, const CacheKey& B)
{
- const std::string& BucketA = A.Bucket;
- const std::string& BucketB = B.Bucket;
- return BucketA == BucketB ? A.Hash < B.Hash : BucketA < BucketB;
+ const std::string& NamespaceA = A.Namespace;
+ const std::string& NamespaceB = B.Namespace;
+ const std::string& BucketA = A.Bucket;
+ const std::string& BucketB = B.Bucket;
+ return NamespaceA == NamespaceB ? (BucketA == BucketB ? A.Hash < B.Hash : BucketA < BucketB) : NamespaceA < NamespaceB;
}
struct CacheChunkRequest