aboutsummaryrefslogtreecommitdiff
path: root/zenserver
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2022-12-12 13:34:51 +0100
committerGitHub <[email protected]>2022-12-12 13:34:51 +0100
commit8dbd301a196041a36be455c1b4cedc81f0d634fe (patch)
tree0c278bb9ac5d185ef1ce6115f7c85067e680d0b7 /zenserver
parentadded [[fallthrough]] annotations to silence static analysis (diff)
downloadzen-8dbd301a196041a36be455c1b4cedc81f0d634fe.tar.xz
zen-8dbd301a196041a36be455c1b4cedc81f0d634fe.zip
Changed so CompressedBuffer::DecodeRawHash returns IoHash just like on the UE side (#208)
removed all use of IoHash::FromBLAKE3() caused by interactions with CompressedBuffer APIs
Diffstat (limited to 'zenserver')
-rw-r--r--zenserver/cache/structuredcachestore.cpp5
-rw-r--r--zenserver/projectstore.cpp4
-rw-r--r--zenserver/upstream/upstreamcache.cpp2
3 files changed, 5 insertions, 6 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index ecb41d57e..9f6707a4a 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -3101,8 +3101,7 @@ TEST_CASE("z$.scrub")
{
IoBuffer AttachmentData = CreateBinaryCacheValue(AttachmentSizes[Index]);
CompressedBuffer CompressedAttachmentData = CompressedBuffer::Compress(SharedBuffer(AttachmentData));
- Record.AddBinaryAttachment(fmt::format("attachment-{}", Index),
- IoHash::FromBLAKE3(CompressedAttachmentData.DecodeRawHash()));
+ Record.AddBinaryAttachment(fmt::format("attachment-{}", Index), CompressedAttachmentData.DecodeRawHash());
Result.Attachments[Index] = CompressedAttachmentData;
}
Result.Record = Record.Save().GetBuffer().AsIoBuffer();
@@ -3144,7 +3143,7 @@ TEST_CASE("z$.scrub")
Zcs.Put("mybucket", Cid, {.Value = Record.Record});
for (const CompressedBuffer& Attachment : Record.Attachments)
{
- CidStore.AddChunk(Attachment.GetCompressed().Flatten().AsIoBuffer(), IoHash::FromBLAKE3(Attachment.DecodeRawHash()));
+ CidStore.AddChunk(Attachment.GetCompressed().Flatten().AsIoBuffer(), Attachment.DecodeRawHash());
}
}
};
diff --git a/zenserver/projectstore.cpp b/zenserver/projectstore.cpp
index 2c44beaee..3e242653a 100644
--- a/zenserver/projectstore.cpp
+++ b/zenserver/projectstore.cpp
@@ -2578,7 +2578,7 @@ namespace testutils {
Object.BeginArray("bulkdata");
for (const auto& Attachment : Attachments)
{
- CbAttachment Attach(Attachment.second, IoHash::FromBLAKE3(Attachment.second.DecodeRawHash()));
+ CbAttachment Attach(Attachment.second, Attachment.second.DecodeRawHash());
Object.BeginObject();
Object << "id"sv << Attachment.first;
Object << "type"sv
@@ -2834,7 +2834,7 @@ TEST_CASE("project.store.partial.read")
}
{
IoBuffer Chunk;
- CHECK(ProjectStore.GetChunk(IoHash::FromBLAKE3(Attachments[OpIds[1]][0].second.DecodeRawHash()).ToHexString(),
+ CHECK(ProjectStore.GetChunk(Attachments[OpIds[1]][0].second.DecodeRawHash().ToHexString(),
HttpContentType::kCompressedBinary,
Chunk) == HttpResponseCode::OK);
IoHash RawHash;
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp
index 6e5422007..e838b5fe2 100644
--- a/zenserver/upstream/upstreamcache.cpp
+++ b/zenserver/upstream/upstreamcache.cpp
@@ -490,7 +490,7 @@ namespace detail {
else
{
CompressedBuffer Compressed = CompressedBuffer::Compress(SharedBuffer(Payload));
- RawHash = IoHash::FromBLAKE3(Compressed.DecodeRawHash());
+ RawHash = Compressed.DecodeRawHash();
if (RawHash == PayloadHash)
{
IsCompressed = true;