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

Function lookupKey

src/db.cpp:109–122  ·  view source on GitHub ↗

Low level key lookup API, not actually called directly from commands * implementations that should instead rely on lookupKeyRead(), * lookupKeyWrite() and lookupKeyReadWithFlags(). */

Source from the content-addressed store, hash-verified

107 * implementations that should instead rely on lookupKeyRead(),
108 * lookupKeyWrite() and lookupKeyReadWithFlags(). */
109static robj* lookupKey(redisDb *db, robj *key, int flags) {
110 auto itr = db->find(key);
111 if (itr) {
112 robj *val = itr.val();
113 lookupKeyUpdateObj(val, flags);
114 if (flags & LOOKUP_UPDATEMVCC) {
115 setMvccTstamp(val, getMvccTstamp());
116 db->trackkey(key, true /* fUpdate */);
117 }
118 return val;
119 } else {
120 return NULL;
121 }
122}
123static robj_roptr lookupKeyConst(redisDb *db, robj *key, int flags) {
124 serverAssert((flags & LOOKUP_UPDATEMVCC) == 0);
125 robj_roptr val;

Callers 2

lookupKeyWriteWithFlagsFunction · 0.85

Calls 6

lookupKeyUpdateObjFunction · 0.85
setMvccTstampFunction · 0.85
getMvccTstampFunction · 0.85
findMethod · 0.45
valMethod · 0.45
trackkeyMethod · 0.45

Tested by

no test coverage detected