| 1628 | } |
| 1629 | |
| 1630 | robj *deserializeStoredObject(const void *data, size_t cb) |
| 1631 | { |
| 1632 | switch (((char*)data)[0]) |
| 1633 | { |
| 1634 | case RDB_TYPE_STRING: |
| 1635 | return deserializeStoredStringObject(((char*)data)+1, cb-1); |
| 1636 | |
| 1637 | default: |
| 1638 | rio payload; |
| 1639 | int type; |
| 1640 | robj *obj; |
| 1641 | rioInitWithConstBuffer(&payload,data,cb); |
| 1642 | if (((type = rdbLoadObjectType(&payload)) == -1) || |
| 1643 | ((obj = rdbLoadObject(type,&payload,nullptr,NULL,OBJ_MVCC_INVALID)) == nullptr)) |
| 1644 | { |
| 1645 | serverPanic("Bad data format"); |
| 1646 | } |
| 1647 | if (rdbLoadType(&payload) == RDB_OPCODE_AUX) |
| 1648 | { |
| 1649 | robj *auxkey, *auxval; |
| 1650 | if ((auxkey = rdbLoadStringObject(&payload)) == NULL) goto eoferr; |
| 1651 | if ((auxval = rdbLoadStringObject(&payload)) == NULL) { |
| 1652 | decrRefCount(auxkey); |
| 1653 | goto eoferr; |
| 1654 | } |
| 1655 | if (strcasecmp(szFromObj(auxkey), "mvcc-tstamp") == 0) { |
| 1656 | setMvccTstamp(obj, strtoull(szFromObj(auxval), nullptr, 10)); |
| 1657 | } |
| 1658 | decrRefCount(auxkey); |
| 1659 | decrRefCount(auxval); |
| 1660 | } |
| 1661 | eoferr: |
| 1662 | return obj; |
| 1663 | } |
| 1664 | serverPanic("Unknown object type loading from storage"); |
| 1665 | } |
| 1666 | |
| 1667 | sds serializeStoredObject(robj_roptr o, sds sdsPrefix) |
| 1668 | { |
no test coverage detected