| 541 | } |
| 542 | |
| 543 | static inline void DecodeFull( |
| 544 | const std::string* str, |
| 545 | std::map<std::string, std::vector<std::pair<uint64_t, std::string*>>>& |
| 546 | value_map) { |
| 547 | const char* buffer = str->c_str(); |
| 548 | uint32_t total_size = str->length(); |
| 549 | DEBUGLOG("total size %u %s", total_size, |
| 550 | ::fedb::base::DebugString(*str).c_str()); |
| 551 | while (total_size > 0) { |
| 552 | uint32_t size = 0; |
| 553 | memcpy(static_cast<void*>(&size), buffer, 4); |
| 554 | memrev32ifbe(static_cast<void*>(&size)); |
| 555 | DEBUGLOG("decode size %u", size); |
| 556 | buffer += 4; |
| 557 | uint32_t pk_size = 0; |
| 558 | memcpy(static_cast<void*>(&pk_size), buffer, 4); |
| 559 | buffer += 4; |
| 560 | memrev32ifbe(static_cast<void*>(&pk_size)); |
| 561 | DEBUGLOG("decode size %u", pk_size); |
| 562 | assert(size > pk_size + 8); |
| 563 | uint64_t time = 0; |
| 564 | memcpy(static_cast<void*>(&time), buffer, 8); |
| 565 | memrev64ifbe(static_cast<void*>(&time)); |
| 566 | buffer += 8; |
| 567 | std::string pk(buffer, pk_size); |
| 568 | buffer += pk_size; |
| 569 | uint32_t value_size = size - 8 - pk_size; |
| 570 | std::string* data = new std::string(value_size, '0'); |
| 571 | memcpy(reinterpret_cast<char*>(&((*data)[0])), buffer, value_size); |
| 572 | buffer += value_size; |
| 573 | if (value_map.find(pk) == value_map.end()) { |
| 574 | value_map.insert(std::make_pair( |
| 575 | pk, std::vector<std::pair<uint64_t, std::string*>>())); |
| 576 | } |
| 577 | value_map[pk].push_back(std::make_pair(time, data)); |
| 578 | total_size -= (size + 8); |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | } // namespace codec |
| 583 | } // namespace fedb |
nothing calls this directly
no test coverage detected