6 #ifndef KAGOME_ADAPTERS_PROTOBUF_STATE_REQUEST 7 #define KAGOME_ADAPTERS_PROTOBUF_STATE_REQUEST 12 #include <libp2p/multi/uvarint.hpp> 27 static std::vector<uint8_t>::iterator
write(
29 std::vector<uint8_t> &out,
30 std::vector<uint8_t>::iterator loaded) {
31 ::api::v1::StateRequest msg;
34 for (
const auto &start : t.
start) {
35 msg.add_start(start.toString());
42 static outcome::result<std::vector<uint8_t>::const_iterator>
read(
44 const std::vector<uint8_t> &src,
45 std::vector<uint8_t>::const_iterator from) {
46 const auto remains = src.size() - std::distance(src.begin(), from);
47 assert(remains >= size(out));
49 ::api::v1::StateRequest msg;
50 if (!msg.ParseFromArray(from.base(), remains)) {
55 if (hash.has_error()) {
58 out.
hash = std::move(hash.value());
60 for (
const auto &strt : msg.start()) {
66 std::advance(from, msg.ByteSizeLong());
73 #endif // KAGOME_ADAPTERS_PROTOBUF_STATE_REQUEST std::vector< common::Buffer > start
primitives::BlockHash hash
Block header hash.
std::vector< uint8_t >::iterator appendToVec(const T &msg, std::vector< uint8_t > &out, std::vector< uint8_t >::iterator loaded)
static outcome::result< std::vector< uint8_t >::const_iterator > read(StateRequest &out, const std::vector< uint8_t > &src, std::vector< uint8_t >::const_iterator from)
static std::vector< uint8_t >::iterator write(const StateRequest &t, std::vector< uint8_t > &out, std::vector< uint8_t >::iterator loaded)
std::string toString() const noexcept
static outcome::result< Blob< size_ > > fromString(std::string_view data)
static size_t size(const StateRequest &t)
static SLBuffer fromString(const std::string_view &src)
stores content of a string to byte array