diff options
| author | Dan Engelbrecht <[email protected]> | 2024-12-05 14:21:12 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-12-05 14:21:12 +0100 |
| commit | d1c9573ef4b54e03b66a9507a57104591078d35b (patch) | |
| tree | 38dbcbe99a5b76d322d1634014bc390e75b01c20 /src/zencore/testutils.cpp | |
| parent | Unity build fixes (#253) (diff) | |
| download | zen-d1c9573ef4b54e03b66a9507a57104591078d35b.tar.xz zen-d1c9573ef4b54e03b66a9507a57104591078d35b.zip | |
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
Diffstat (limited to 'src/zencore/testutils.cpp')
| -rw-r--r-- | src/zencore/testutils.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
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 |