diff options
| author | Stefan Boberg <[email protected]> | 2021-09-13 22:25:03 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-13 22:25:03 +0200 |
| commit | f277fad0ea747807021bb92ae8fd026384901fb7 (patch) | |
| tree | ffdcb6af33450105d3dc0d5046bec8090d6dff27 /zenhttp/httpshared.h | |
| parent | Changed package parsing test code (diff) | |
| download | zen-f277fad0ea747807021bb92ae8fd026384901fb7.tar.xz zen-f277fad0ea747807021bb92ae8fd026384901fb7.zip | |
Implemented intended package streaming API flow (but currently it "streams" from memory)
Diffstat (limited to 'zenhttp/httpshared.h')
| -rw-r--r-- | zenhttp/httpshared.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/zenhttp/httpshared.h b/zenhttp/httpshared.h index e7c9e4a56..06fdb104f 100644 --- a/zenhttp/httpshared.h +++ b/zenhttp/httpshared.h @@ -2,8 +2,11 @@ #pragma once +#include <zencore/iobuffer.h> #include <zencore/iohash.h> +#include <functional> + namespace zen { class IoBuffer; @@ -33,6 +36,10 @@ static_assert(sizeof(CbAttachmentEntry) == 32); std::vector<IoBuffer> FormatPackageMessage(const CbPackage& Data); CompositeBuffer FormatPackageMessageBuffer(const CbPackage& Data); -CbPackage ParsePackageMessage(IoBuffer Payload); +CbPackage ParsePackageMessage( + IoBuffer Payload, + std::function<IoBuffer(const IoHash& Cid, uint64_t Size)> CreateBuffer = [](const IoHash&, uint64_t Size) -> IoBuffer { + return IoBuffer{Size}; + }); } // namespace zen |