MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / deserializeStoredObject

Function deserializeStoredObject

src/object.cpp:1630–1665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1628}
1629
1630robj *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
1667sds serializeStoredObject(robj_roptr o, sds sdsPrefix)
1668{

Callers 4

ensureMethod · 0.85
prefetchKeysAsyncMethod · 0.85
flushQueuedKeysMethod · 0.85

Calls 9

rioInitWithConstBufferFunction · 0.85
rdbLoadObjectTypeFunction · 0.85
rdbLoadObjectFunction · 0.85
rdbLoadTypeFunction · 0.85
rdbLoadStringObjectFunction · 0.85
decrRefCountFunction · 0.85
szFromObjFunction · 0.85
setMvccTstampFunction · 0.85

Tested by

no test coverage detected