diff options
| author | Dan Engelbrecht <[email protected]> | 2022-11-18 11:35:13 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-18 02:35:13 -0800 |
| commit | 55225621f018904abf7e212320bb784dc64f8ac3 (patch) | |
| tree | 3fb962e9e0553448f9d42612bb078ff072308e1c /zenutil/cache/cacherequests.cpp | |
| parent | move BasicFile to zenutil to remove zenstore dependency from zen command (#190) (diff) | |
| download | zen-55225621f018904abf7e212320bb784dc64f8ac3.tar.xz zen-55225621f018904abf7e212320bb784dc64f8ac3.zip | |
Add `import-project` and `export-project` (#183)
* Add `import-project` and `export-project` command line parsing
Diffstat (limited to 'zenutil/cache/cacherequests.cpp')
| -rw-r--r-- | zenutil/cache/cacherequests.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/zenutil/cache/cacherequests.cpp b/zenutil/cache/cacherequests.cpp index 0ac6c35ed..1ba2721b6 100644 --- a/zenutil/cache/cacherequests.cpp +++ b/zenutil/cache/cacherequests.cpp @@ -268,8 +268,9 @@ namespace cacherequests { const CompressedBuffer& Buffer = Value.Body; if (Buffer) { - Writer.AddBinaryAttachment("RawHash", IoHash::FromBLAKE3(Buffer.GetRawHash())); - OutPackage.AddAttachment(CbAttachment(Buffer)); + IoHash AttachmentHash = IoHash::FromBLAKE3(Buffer.GetRawHash()); + Writer.AddBinaryAttachment("RawHash", AttachmentHash); + OutPackage.AddAttachment(CbAttachment(Buffer, AttachmentHash)); Writer.AddInteger("RawSize", Buffer.GetRawSize()); } else @@ -499,16 +500,17 @@ namespace cacherequests { Writer.BeginArray("Values"); for (const GetCacheRecordResultValue& Value : RecordResult->Values) { + IoHash AttachmentHash = Value.Body ? IoHash::FromBLAKE3(Value.Body.GetRawHash()) : Value.RawHash; Writer.BeginObject(); { Writer.AddObjectId("Id", Value.Id); - Writer.AddHash("RawHash", Value.Body ? IoHash::FromBLAKE3(Value.Body.GetRawHash()) : Value.RawHash); + Writer.AddHash("RawHash", AttachmentHash); Writer.AddInteger("RawSize", Value.Body ? Value.Body.GetRawSize() : Value.RawSize); } Writer.EndObject(); if (Value.Body) { - OutPackage.AddAttachment(CbAttachment(Value.Body)); + OutPackage.AddAttachment(CbAttachment(Value.Body, AttachmentHash)); } } @@ -594,8 +596,9 @@ namespace cacherequests { { return false; } - Writer.AddBinaryAttachment("RawHash", IoHash::FromBLAKE3(ValueRequest.Body.GetRawHash())); - OutPackage.AddAttachment(CbAttachment(ValueRequest.Body)); + IoHash AttachmentHash = IoHash::FromBLAKE3(ValueRequest.Body.GetRawHash()); + Writer.AddBinaryAttachment("RawHash", AttachmentHash); + OutPackage.AddAttachment(CbAttachment(ValueRequest.Body, AttachmentHash)); } else if (ValueRequest.RawHash != IoHash::Zero) { @@ -797,7 +800,7 @@ namespace cacherequests { ResponseObject.AddHash("RawHash", ValueResult.RawHash); if (ValueResult.Body) { - OutPackage.AddAttachment(CbAttachment(ValueResult.Body)); + OutPackage.AddAttachment(CbAttachment(ValueResult.Body, ValueResult.RawHash)); } else { |