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

Function filterKey

src/db.cpp:1146–1161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1144
1145
1146static bool filterKey(robj_roptr kobj, sds pat, int patlen)
1147{
1148 bool filter = false;
1149 if (sdsEncodedObject(kobj)) {
1150 if (!stringmatchlen(pat, patlen, szFromObj(kobj), sdslen(szFromObj(kobj)), 0))
1151 filter = true;
1152 } else {
1153 char buf[LONG_STR_SIZE];
1154 int len;
1155
1156 serverAssert(kobj->encoding == OBJ_ENCODING_INT);
1157 len = ll2string(buf,sizeof(buf),(long)ptrFromObj(kobj));
1158 if (!stringmatchlen(pat, patlen, buf, len, 0)) filter = true;
1159 }
1160 return filter;
1161}
1162
1163/* This command implements SCAN, HSCAN and SSCAN commands.
1164 * If object 'o' is passed, then it must be a Hash, Set or Zset object, otherwise

Callers 2

scanGenericCommandFunction · 0.85
scanFilterAndReplyFunction · 0.85

Calls 5

stringmatchlenFunction · 0.85
szFromObjFunction · 0.85
sdslenFunction · 0.85
ll2stringFunction · 0.85
ptrFromObjFunction · 0.85

Tested by

no test coverage detected