diff options
| author | Stefan Boberg <[email protected]> | 2022-01-25 11:17:21 +0100 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2022-01-25 11:17:21 +0100 |
| commit | 39fe91b4e403a74c059ce13d20ba13f6d9ec9ca7 (patch) | |
| tree | 69af4ca9c74ef53d7fc16b37eb1072cb7d2de403 /zenserver/cache | |
| parent | prepare_commit: Add filter for filenames. Print full path from root in the di... (diff) | |
| download | zen-39fe91b4e403a74c059ce13d20ba13f6d9ec9ca7.tar.xz zen-39fe91b4e403a74c059ce13d20ba13f6d9ec9ca7.zip | |
Implemented support for storing compressed buffers as values in structured cache store
Diffstat (limited to 'zenserver/cache')
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 4 | ||||
| -rw-r--r-- | zenserver/cache/structuredcachestore.h | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index 2bba2e8e6..de5bccc3a 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -614,6 +614,10 @@ ZenCacheDiskLayer::CacheBucket::Put(const IoHash& HashKey, const ZenCacheValue& { EntryFlags |= DiskLocation::kStructured; } + else if (Value.Value.GetContentType() == ZenContentType::kCompressedBinary) + { + EntryFlags |= DiskLocation::kCompressed; + } RwLock::ExclusiveLockScope _(m_IndexLock); diff --git a/zenserver/cache/structuredcachestore.h b/zenserver/cache/structuredcachestore.h index 8b015d0fb..4f162c0ba 100644 --- a/zenserver/cache/structuredcachestore.h +++ b/zenserver/cache/structuredcachestore.h @@ -84,11 +84,12 @@ struct DiskLocation } static const uint64_t kOffsetMask = 0x0000'ffFF'ffFF'ffFFull; - static const uint64_t kSizeMask = 0x00FF'0000'0000'0000ull; + static const uint64_t kSizeMask = 0x00FF'0000'0000'0000ull; // Most significant bits of value size (lower 32 bits in LowerSize) static const uint64_t kFlagsMask = 0xff00'0000'0000'0000ull; - static const uint64_t kStandaloneFile = 0x8000'0000'0000'0000ull; - static const uint64_t kStructured = 0x4000'0000'0000'0000ull; - static const uint64_t kTombStone = 0x2000'0000'0000'0000ull; + static const uint64_t kStandaloneFile = 0x8000'0000'0000'0000ull; // Stored as a separate file + static const uint64_t kStructured = 0x4000'0000'0000'0000ull; // Serialized as compact binary + static const uint64_t kTombStone = 0x2000'0000'0000'0000ull; // Represents a deleted key/value + static const uint64_t kCompressed = 0x1000'0000'0000'0000ull; // Stored in compressed buffer format static uint64_t CombineOffsetAndFlags(uint64_t Offset, uint64_t Flags) { return Offset | Flags; } @@ -103,6 +104,11 @@ struct DiskLocation { ContentType = ZenContentType::kCbObject; } + + if (IsFlagSet(DiskLocation::kCompressed)) + { + ContentType = ZenContentType::kCompressedBinary; + } return ContentType; } |