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

Function blmoveGenericCommand

src/t_list.cpp:992–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

990}
991
992void blmoveGenericCommand(client *c, int wherefrom, int whereto, mstime_t timeout) {
993 robj *key = lookupKeyWrite(c->db, c->argv[1]);
994 if (checkType(c,key,OBJ_LIST)) return;
995
996 if (key == NULL) {
997 if (c->flags & CLIENT_DENY_BLOCKING) {
998 /* Blocking against an empty list when blocking is not allowed
999 * returns immediately. */
1000 addReplyNull(c);
1001 } else {
1002 /* The list is empty and the client blocks. */
1003 struct listPos pos = {wherefrom, whereto};
1004 blockForKeys(c,BLOCKED_LIST,c->argv + 1,1,timeout,c->argv[2],&pos,NULL);
1005 }
1006 } else {
1007 /* The list exists and has elements, so
1008 * the regular lmoveCommand is executed. */
1009 serverAssertWithInfo(c,key,listTypeLength(key) > 0);
1010 lmoveGenericCommand(c,wherefrom,whereto);
1011 }
1012}
1013
1014/* BLMOVE <source> <destination> (LEFT|RIGHT) (LEFT|RIGHT) <timeout> */
1015void blmoveCommand(client *c) {

Callers 2

blmoveCommandFunction · 0.85
brpoplpushCommandFunction · 0.85

Calls 6

lookupKeyWriteFunction · 0.85
checkTypeFunction · 0.85
addReplyNullFunction · 0.85
blockForKeysFunction · 0.85
listTypeLengthFunction · 0.85
lmoveGenericCommandFunction · 0.85

Tested by

no test coverage detected