From 81895699131121a1dab67ce026dcf8490c4de9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 31 Aug 2024 22:17:16 +0200 Subject: Network streams, accept for data response Changelog: Implemented streams in network protocol --- src/storage.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/storage.cpp') diff --git a/src/storage.cpp b/src/storage.cpp index 19f35a9..fd985c7 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -1579,6 +1579,21 @@ optional> ObjectT::decode(const S & st, return nullopt; } +template< class S > +vector< ObjectT< S >> ObjectT< S >::decodeMany( const S & st, + const std::vector< uint8_t > & data) +{ + vector< ObjectT< S >> objects; + auto cur = data.begin(); + + while( auto pair = decodePrefix( st, cur, data.end() )) { + auto [ obj, next ] = *pair; + objects.push_back( move( obj )); + cur = next; + } + return objects; +} + template vector ObjectT::encode() const { -- cgit v1.2.3