| 444 | return Encode(data->data, data->size, buffer, offset); |
| 445 | } |
| 446 | static inline int32_t EncodeRows(const std::vector<::fedb::base::Slice>& rows, |
| 447 | uint32_t total_block_size, std::string* body) { |
| 448 | if (body == NULL) { |
| 449 | PDLOG(WARNING, "invalid output body"); |
| 450 | return -1; |
| 451 | } |
| 452 | |
| 453 | uint32_t total_size = rows.size() * 4 + total_block_size; |
| 454 | if (rows.size() > 0) { |
| 455 | body->resize(total_size); |
| 456 | } |
| 457 | uint32_t offset = 0; |
| 458 | char* rbuffer = reinterpret_cast<char*>(&((*body)[0])); |
| 459 | for (auto lit = rows.begin(); lit != rows.end(); ++lit) { |
| 460 | ::fedb::codec::Encode(lit->data(), lit->size(), rbuffer, offset); |
| 461 | offset += (4 + lit->size()); |
| 462 | } |
| 463 | return total_size; |
| 464 | } |
| 465 | |
| 466 | static inline int32_t EncodeRows( |
| 467 | const boost::container::deque<std::pair<uint64_t, ::fedb::base::Slice>>& |