From d1c9573ef4b54e03b66a9507a57104591078d35b Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 5 Dec 2024 14:21:12 +0100 Subject: projectstore getchunks rpc with modtag (#244) Feature: Project store "getchunks" rpc call /prj/{project}/oplog/{log}/rpc extended to accept both CAS (RawHash) and Id (Oid) identifiers as well as partial ranges --- src/zencore/testutils.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/zencore/testutils.cpp') diff --git a/src/zencore/testutils.cpp b/src/zencore/testutils.cpp index d4c8aeaef..641d5508a 100644 --- a/src/zencore/testutils.cpp +++ b/src/zencore/testutils.cpp @@ -71,6 +71,26 @@ CreateRandomBlob(uint64_t Size) return Data; }; +IoBuffer +CreateSemiRandomBlob(uint64_t Size) +{ + IoBuffer Result(Size); + const size_t PartCount = (Size / (1u * 1024u * 64)) + 1; + const size_t PartSize = Size / PartCount; + auto Part = CreateRandomBlob(PartSize); + auto Remain = Result.GetMutableView().CopyFrom(Part.GetView()); + while (Remain.GetSize() >= PartSize) + { + Remain = Remain.CopyFrom(Part.GetView()); + } + if (Remain.GetSize() > 0) + { + auto RemainBuffer = CreateRandomBlob(Remain.GetSize()); + Remain.CopyFrom(RemainBuffer.GetView()); + } + return Result; +}; + } // namespace zen #endif // ZEN_WITH_TESTS -- cgit v1.2.3