aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-03-21 10:58:28 +0100
committerGitHub Enterprise <[email protected]>2024-03-21 10:58:28 +0100
commit9b82209e3368de806a48554d85cb7c364973eb2d (patch)
tree8b52dbe1fd5a1a3255c51198a7b31bef77cf9009 /src/zenutil
parentimproved process monitoring behaviour with invalid pids (#16) (diff)
downloadzen-9b82209e3368de806a48554d85cb7c364973eb2d.tar.xz
zen-9b82209e3368de806a48554d85cb7c364973eb2d.zip
add support for responding with partial cache chunks (#11)
* add support for responding with partial cache chunks
Diffstat (limited to 'src/zenutil')
-rw-r--r--src/zenutil/cache/cacherequests.cpp3
-rw-r--r--src/zenutil/include/zenutil/cache/cacherequests.h7
-rw-r--r--src/zenutil/include/zenutil/packageformat.h3
3 files changed, 8 insertions, 5 deletions
diff --git a/src/zenutil/cache/cacherequests.cpp b/src/zenutil/cache/cacherequests.cpp
index f4de6bacd..442cf0dfc 100644
--- a/src/zenutil/cache/cacherequests.cpp
+++ b/src/zenutil/cache/cacherequests.cpp
@@ -792,8 +792,9 @@ namespace cacherequests {
bool Succeeded = !RawHashField.HasError();
if (Succeeded)
{
+ ValueResult.RawOffset = RecordObject["RawOffset"].AsUInt64(0);
const CbAttachment* Attachment = Package.FindAttachment(ValueResult.RawHash);
- ValueResult.Body = Attachment ? Attachment->AsCompressedBinary() : CompressedBuffer();
+ ValueResult.Body = Attachment ? Attachment->AsCompressedBinary().MakeOwned() : CompressedBuffer();
if (ValueResult.Body)
{
ValueResult.RawSize = ValueResult.Body.DecodeRawSize();
diff --git a/src/zenutil/include/zenutil/cache/cacherequests.h b/src/zenutil/include/zenutil/cache/cacherequests.h
index abc5a3c13..0913efc65 100644
--- a/src/zenutil/include/zenutil/cache/cacherequests.h
+++ b/src/zenutil/include/zenutil/cache/cacherequests.h
@@ -195,9 +195,10 @@ namespace cacherequests {
struct CacheValueResult
{
- uint64_t RawSize = 0;
- IoHash RawHash = IoHash::Zero;
- CompressedBuffer Body = CompressedBuffer::Null;
+ uint64_t RawSize = 0;
+ uint64_t RawOffset = 0;
+ IoHash RawHash = IoHash::Zero;
+ CompressedBuffer Body = CompressedBuffer::Null;
};
struct CacheValuesResult
diff --git a/src/zenutil/include/zenutil/packageformat.h b/src/zenutil/include/zenutil/packageformat.h
index 0b8495fbd..c90b840da 100644
--- a/src/zenutil/include/zenutil/packageformat.h
+++ b/src/zenutil/include/zenutil/packageformat.h
@@ -89,7 +89,8 @@ enum class RpcAcceptOptions : uint16_t
{
kNone = 0,
kAllowLocalReferences = (1u << 0),
- kAllowPartialLocalReferences = (1u << 1)
+ kAllowPartialLocalReferences = (1u << 1),
+ kAllowPartialCacheChunks = (1u << 2)
};
gsl_DEFINE_ENUM_BITMASK_OPERATORS(RpcAcceptOptions);