1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include <zencore/iohash.h>
#include <zencore/string.h>
#include <zencore/uid.h>
#include <gsl/gsl-lite.hpp>
namespace zen {
enum class CachePolicy : uint8_t
{
None = 0,
QueryLocal = 1 << 0,
QueryRemote = 1 << 1,
Query = QueryLocal | QueryRemote,
StoreLocal = 1 << 2,
StoreRemote = 1 << 3,
Store = StoreLocal | StoreRemote,
SkipMeta = 1 << 4,
SkipValue = 1 << 5,
SkipAttachments = 1 << 6,
SkipData = SkipMeta | SkipValue | SkipAttachments,
SkipLocalCopy = 1 << 7,
Local = QueryLocal | StoreLocal,
Remote = QueryRemote | StoreRemote,
Default = Query | Store,
Disable = None,
};
gsl_DEFINE_ENUM_BITMASK_OPERATORS(CachePolicy);
CachePolicy ParseQueryCachePolicy(std::string_view QueryPolicy, CachePolicy Default = CachePolicy::Query);
CachePolicy ParseStoreCachePolicy(std::string_view StorePolicy, CachePolicy Default = CachePolicy::Store);
CachePolicy ParseSkipCachePolicy(std::string_view SkipPolicy, CachePolicy Default = CachePolicy::None);
struct CacheKey
{
std::string Bucket;
IoHash Hash;
static CacheKey Create(std::string_view Bucket, const IoHash& Hash) { return {.Bucket = ToLower(Bucket), .Hash = Hash}; }
static CacheKey None;
};
struct CacheChunk
{
CacheKey Key;
IoHash Id;
uint64_t RawOffset = 0ull;
uint64_t RawSize = ~uint64_t(0);
};
} // namespace zen
|