diff options
| author | Per Larsson <[email protected]> | 2021-11-15 08:20:10 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-11-15 08:20:10 +0100 |
| commit | 6fcd94a6dd98d2643251edf29cf078e6d8641403 (patch) | |
| tree | 728c7bf19d0d2e8bc0b7a14b2153b1b52b37e16f | |
| parent | Removed sorting of chunk requests. (diff) | |
| download | zen-6fcd94a6dd98d2643251edf29cf078e6d8641403.tar.xz zen-6fcd94a6dd98d2643251edf29cf078e6d8641403.zip | |
Updated cache policy according to UE.
| -rw-r--r-- | zenserver/cache/structuredcache.h | 2 | ||||
| -rw-r--r-- | zenutil/include/zenutil/cache/cachepolicy.h | 76 |
2 files changed, 61 insertions, 17 deletions
diff --git a/zenserver/cache/structuredcache.h b/zenserver/cache/structuredcache.h index 3d9914606..51073d05d 100644 --- a/zenserver/cache/structuredcache.h +++ b/zenserver/cache/structuredcache.h @@ -20,7 +20,7 @@ class CasStore; class CidStore; class UpstreamCache; class ZenCacheStore; -enum class CachePolicy : uint8_t; +enum class CachePolicy : uint32_t; /** * Structured cache service. Imposes constraints on keys, supports blobs and diff --git a/zenutil/include/zenutil/cache/cachepolicy.h b/zenutil/include/zenutil/cache/cachepolicy.h index 0b5a70ea8..5cf19238e 100644 --- a/zenutil/include/zenutil/cache/cachepolicy.h +++ b/zenutil/include/zenutil/cache/cachepolicy.h @@ -13,24 +13,68 @@ namespace zen { class CbObjectView; class CbWriter; -enum class CachePolicy : uint8_t +enum class CachePolicy : uint32_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, + /** A value without any flags set. */ + None = 0, + + /** Allow a cache request to query local caches. */ + QueryLocal = 1 << 0, + /** Allow a cache request to query remote caches. */ + QueryRemote = 1 << 1, + /** Allow a cache request to query any caches. */ + Query = QueryLocal | QueryRemote, + + /** Allow cache records and values to be stored in local caches. */ + StoreLocal = 1 << 2, + /** Allow cache records and values to be stored in remote caches. */ + StoreRemote = 1 << 3, + /** Allow cache records and values to be stored in any caches. */ + Store = StoreLocal | StoreRemote, + + /** Skip fetching the metadata for record requests. */ + SkipMeta = 1 << 4, + /** Skip fetching the value for record, chunk, or value requests. */ + SkipValue = 1 << 5, + /** Skip fetching the attachments for record requests. */ SkipAttachments = 1 << 6, - SkipData = SkipMeta | SkipValue | SkipAttachments, - SkipLocalCopy = 1 << 7, - Local = QueryLocal | StoreLocal, - Remote = QueryRemote | StoreRemote, - Default = Query | Store, - Disable = None, + /** + * Skip fetching the data for any requests. + * + * Put requests with skip flags may assume that record existence implies payload existence. + */ + SkipData = SkipMeta | SkipValue | SkipAttachments, + + /** + * Keep records in the cache for at least the duration of the session. + * + * This is a hint that the record may be accessed again in this session. This is mainly meant + * to be used when subsequent accesses will not tolerate a cache miss. + */ + KeepAlive = 1 << 7, + + /** + * Partial output will be provided with the error status when a required payload is missing. + * + * This is meant for cases when the missing payloads can be individually recovered or rebuilt + * without rebuilding the whole record. The cache automatically adds this flag when there are + * other cache stores that it may be able to recover missing payloads from. + * + * Requests for records would return records where the missing payloads have a hash and size, + * but no data. Requests for chunks or values would return the hash and size, but no data. + */ + PartialOnError = 1 << 8, + + /** Allow cache requests to query and store records and values in local caches. */ + Local = QueryLocal | StoreLocal, + /** Allow cache requests to query and store records and values in remote caches. */ + Remote = QueryRemote | StoreRemote, + + /** Allow cache requests to query and store records and values in any caches. */ + Default = Query | Store, + + /** Do not allow cache requests to query or store records and values in any caches. */ + Disable = None, }; gsl_DEFINE_ENUM_BITMASK_OPERATORS(CachePolicy); |