Commit 32f80e2f authored by antirez's avatar antirez
Browse files

RDMF: More consistent define names.

parent 40eb548a
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#include "anet.h" #include "anet.h"
#include "ae.h" #include "ae.h"
#define REDIS_NOTUSED(V) ((void) V) #define UNUSED(V) ((void) V)
#define OUTPUT_STANDARD 0 #define OUTPUT_STANDARD 0
#define OUTPUT_RAW 1 #define OUTPUT_RAW 1
...@@ -2128,7 +2128,7 @@ unsigned long compute_something_fast(void) { ...@@ -2128,7 +2128,7 @@ unsigned long compute_something_fast(void) {
} }
static void intrinsicLatencyModeStop(int s) { static void intrinsicLatencyModeStop(int s) {
REDIS_NOTUSED(s); UNUSED(s);
force_cancel_loop = 1; force_cancel_loop = 1;
} }
......
This diff is collapsed.
...@@ -81,7 +81,7 @@ static off_t rioBufferTell(rio *r) { ...@@ -81,7 +81,7 @@ static off_t rioBufferTell(rio *r) {
/* Flushes any buffer to target device if applicable. Returns 1 on success /* Flushes any buffer to target device if applicable. Returns 1 on success
* and 0 on failures. */ * and 0 on failures. */
static int rioBufferFlush(rio *r) { static int rioBufferFlush(rio *r) {
REDIS_NOTUSED(r); UNUSED(r);
return 1; /* Nothing to do, our write just appends to the buffer. */ return 1; /* Nothing to do, our write just appends to the buffer. */
} }
...@@ -177,7 +177,7 @@ static size_t rioFdsetWrite(rio *r, const void *buf, size_t len) { ...@@ -177,7 +177,7 @@ static size_t rioFdsetWrite(rio *r, const void *buf, size_t len) {
if (len) { if (len) {
r->io.fdset.buf = sdscatlen(r->io.fdset.buf,buf,len); r->io.fdset.buf = sdscatlen(r->io.fdset.buf,buf,len);
len = 0; /* Prevent entering the while belove if we don't flush. */ len = 0; /* Prevent entering the while belove if we don't flush. */
if (sdslen(r->io.fdset.buf) > REDIS_IOBUF_LEN) doflush = 1; if (sdslen(r->io.fdset.buf) > PROTO_IOBUF_LEN) doflush = 1;
} }
if (doflush) { if (doflush) {
...@@ -232,9 +232,9 @@ static size_t rioFdsetWrite(rio *r, const void *buf, size_t len) { ...@@ -232,9 +232,9 @@ static size_t rioFdsetWrite(rio *r, const void *buf, size_t len) {
/* Returns 1 or 0 for success/failure. */ /* Returns 1 or 0 for success/failure. */
static size_t rioFdsetRead(rio *r, void *buf, size_t len) { static size_t rioFdsetRead(rio *r, void *buf, size_t len) {
REDIS_NOTUSED(r); UNUSED(r);
REDIS_NOTUSED(buf); UNUSED(buf);
REDIS_NOTUSED(len); UNUSED(len);
return 0; /* Error, this target does not support reading. */ return 0; /* Error, this target does not support reading. */
} }
......
...@@ -224,7 +224,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { ...@@ -224,7 +224,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
char *recursion_warning = char *recursion_warning =
"luaRedisGenericCommand() recursive call detected. " "luaRedisGenericCommand() recursive call detected. "
"Are you doing funny stuff with Lua debug hooks?"; "Are you doing funny stuff with Lua debug hooks?";
serverLog(REDIS_WARNING,"%s",recursion_warning); serverLog(LL_WARNING,"%s",recursion_warning);
luaPushError(lua,recursion_warning); luaPushError(lua,recursion_warning);
return 1; return 1;
} }
...@@ -309,7 +309,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { ...@@ -309,7 +309,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
c->cmd = cmd; c->cmd = cmd;
/* There are commands that are not allowed inside scripts. */ /* There are commands that are not allowed inside scripts. */
if (cmd->flags & REDIS_CMD_NOSCRIPT) { if (cmd->flags & CMD_NOSCRIPT) {
luaPushError(lua, "This Redis command is not allowed from scripts"); luaPushError(lua, "This Redis command is not allowed from scripts");
goto cleanup; goto cleanup;
} }
...@@ -317,14 +317,14 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { ...@@ -317,14 +317,14 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
/* Write commands are forbidden against read-only slaves, or if a /* Write commands are forbidden against read-only slaves, or if a
* command marked as non-deterministic was already called in the context * command marked as non-deterministic was already called in the context
* of this script. */ * of this script. */
if (cmd->flags & REDIS_CMD_WRITE) { if (cmd->flags & CMD_WRITE) {
if (server.lua_random_dirty) { if (server.lua_random_dirty) {
luaPushError(lua, luaPushError(lua,
"Write commands not allowed after non deterministic commands"); "Write commands not allowed after non deterministic commands");
goto cleanup; goto cleanup;
} else if (server.masterhost && server.repl_slave_ro && } else if (server.masterhost && server.repl_slave_ro &&
!server.loading && !server.loading &&
!(server.lua_caller->flags & REDIS_MASTER)) !(server.lua_caller->flags & CLIENT_MASTER))
{ {
luaPushError(lua, shared.roslaveerr->ptr); luaPushError(lua, shared.roslaveerr->ptr);
goto cleanup; goto cleanup;
...@@ -342,7 +342,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { ...@@ -342,7 +342,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
* first write in the context of this script, otherwise we can't stop * first write in the context of this script, otherwise we can't stop
* in the middle. */ * in the middle. */
if (server.maxmemory && server.lua_write_dirty == 0 && if (server.maxmemory && server.lua_write_dirty == 0 &&
(cmd->flags & REDIS_CMD_DENYOOM)) (cmd->flags & CMD_DENYOOM))
{ {
if (freeMemoryIfNeeded() == C_ERR) { if (freeMemoryIfNeeded() == C_ERR) {
luaPushError(lua, shared.oomerr->ptr); luaPushError(lua, shared.oomerr->ptr);
...@@ -350,16 +350,16 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { ...@@ -350,16 +350,16 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
} }
} }
if (cmd->flags & REDIS_CMD_RANDOM) server.lua_random_dirty = 1; if (cmd->flags & CMD_RANDOM) server.lua_random_dirty = 1;
if (cmd->flags & REDIS_CMD_WRITE) server.lua_write_dirty = 1; if (cmd->flags & CMD_WRITE) server.lua_write_dirty = 1;
/* If this is a Redis Cluster node, we need to make sure Lua is not /* If this is a Redis Cluster node, we need to make sure Lua is not
* trying to access non-local keys, with the exception of commands * trying to access non-local keys, with the exception of commands
* received from our master. */ * received from our master. */
if (server.cluster_enabled && !(server.lua_caller->flags & REDIS_MASTER)) { if (server.cluster_enabled && !(server.lua_caller->flags & CLIENT_MASTER)) {
/* Duplicate relevant flags in the lua client. */ /* Duplicate relevant flags in the lua client. */
c->flags &= ~(REDIS_READONLY|REDIS_ASKING); c->flags &= ~(CLIENT_READONLY|CLIENT_ASKING);
c->flags |= server.lua_caller->flags & (REDIS_READONLY|REDIS_ASKING); c->flags |= server.lua_caller->flags & (CLIENT_READONLY|CLIENT_ASKING);
if (getNodeByQuery(c,c->cmd,c->argv,c->argc,NULL,NULL) != if (getNodeByQuery(c,c->cmd,c->argv,c->argc,NULL,NULL) !=
server.cluster->myself) server.cluster->myself)
{ {
...@@ -371,12 +371,12 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { ...@@ -371,12 +371,12 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
} }
/* Run the command */ /* Run the command */
call(c,REDIS_CALL_SLOWLOG | REDIS_CALL_STATS); call(c,CMD_CALL_SLOWLOG | CMD_CALL_STATS);
/* Convert the result of the Redis command into a suitable Lua type. /* Convert the result of the Redis command into a suitable Lua type.
* The first thing we need is to create a single string from the client * The first thing we need is to create a single string from the client
* output buffers. */ * output buffers. */
if (listLength(c->reply) == 0 && c->bufpos < REDIS_REPLY_CHUNK_BYTES) { if (listLength(c->reply) == 0 && c->bufpos < PROTO_REPLY_CHUNK_BYTES) {
/* This is a fast path for the common case of a reply inside the /* This is a fast path for the common case of a reply inside the
* client static buffer. Don't create an SDS string but just use * client static buffer. Don't create an SDS string but just use
* the client buffer directly. */ * the client buffer directly. */
...@@ -397,7 +397,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { ...@@ -397,7 +397,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
redisProtocolToLuaType(lua,reply); redisProtocolToLuaType(lua,reply);
/* Sort the output array if needed, assuming it is a non-null multi bulk /* Sort the output array if needed, assuming it is a non-null multi bulk
* reply as expected. */ * reply as expected. */
if ((cmd->flags & REDIS_CMD_SORT_FOR_SCRIPT) && if ((cmd->flags & CMD_SORT_FOR_SCRIPT) &&
(reply[0] == '*' && reply[1] != '-')) { (reply[0] == '*' && reply[1] != '-')) {
luaSortArray(lua); luaSortArray(lua);
} }
...@@ -515,7 +515,7 @@ int luaLogCommand(lua_State *lua) { ...@@ -515,7 +515,7 @@ int luaLogCommand(lua_State *lua) {
return 1; return 1;
} }
level = lua_tonumber(lua,-argc); level = lua_tonumber(lua,-argc);
if (level < REDIS_DEBUG || level > REDIS_WARNING) { if (level < LL_DEBUG || level > LL_WARNING) {
luaPushError(lua, "Invalid debug level."); luaPushError(lua, "Invalid debug level.");
return 1; return 1;
} }
...@@ -539,12 +539,12 @@ int luaLogCommand(lua_State *lua) { ...@@ -539,12 +539,12 @@ int luaLogCommand(lua_State *lua) {
void luaMaskCountHook(lua_State *lua, lua_Debug *ar) { void luaMaskCountHook(lua_State *lua, lua_Debug *ar) {
long long elapsed; long long elapsed;
REDIS_NOTUSED(ar); UNUSED(ar);
REDIS_NOTUSED(lua); UNUSED(lua);
elapsed = mstime() - server.lua_time_start; elapsed = mstime() - server.lua_time_start;
if (elapsed >= server.lua_time_limit && server.lua_timedout == 0) { if (elapsed >= server.lua_time_limit && server.lua_timedout == 0) {
serverLog(REDIS_WARNING,"Lua slow script detected: still in execution after %lld milliseconds. You can try killing the script using the SCRIPT KILL command.",elapsed); serverLog(LL_WARNING,"Lua slow script detected: still in execution after %lld milliseconds. You can try killing the script using the SCRIPT KILL command.",elapsed);
server.lua_timedout = 1; server.lua_timedout = 1;
/* Once the script timeouts we reenter the event loop to permit others /* Once the script timeouts we reenter the event loop to permit others
* to call SCRIPT KILL or SHUTDOWN NOSAVE if needed. For this reason * to call SCRIPT KILL or SHUTDOWN NOSAVE if needed. For this reason
...@@ -555,7 +555,7 @@ void luaMaskCountHook(lua_State *lua, lua_Debug *ar) { ...@@ -555,7 +555,7 @@ void luaMaskCountHook(lua_State *lua, lua_Debug *ar) {
} }
if (server.lua_timedout) processEventsWhileBlocked(); if (server.lua_timedout) processEventsWhileBlocked();
if (server.lua_kill) { if (server.lua_kill) {
serverLog(REDIS_WARNING,"Lua script killed by user with SCRIPT KILL."); serverLog(LL_WARNING,"Lua script killed by user with SCRIPT KILL.");
lua_pushstring(lua,"Script killed by user with SCRIPT KILL..."); lua_pushstring(lua,"Script killed by user with SCRIPT KILL...");
lua_error(lua); lua_error(lua);
} }
...@@ -668,20 +668,20 @@ void scriptingInit(void) { ...@@ -668,20 +668,20 @@ void scriptingInit(void) {
lua_pushcfunction(lua,luaLogCommand); lua_pushcfunction(lua,luaLogCommand);
lua_settable(lua,-3); lua_settable(lua,-3);
lua_pushstring(lua,"LOG_DEBUG"); lua_pushstring(lua,"LL_DEBUG");
lua_pushnumber(lua,REDIS_DEBUG); lua_pushnumber(lua,LL_DEBUG);
lua_settable(lua,-3); lua_settable(lua,-3);
lua_pushstring(lua,"LOG_VERBOSE"); lua_pushstring(lua,"LL_VERBOSE");
lua_pushnumber(lua,REDIS_VERBOSE); lua_pushnumber(lua,LL_VERBOSE);
lua_settable(lua,-3); lua_settable(lua,-3);
lua_pushstring(lua,"LOG_NOTICE"); lua_pushstring(lua,"LL_NOTICE");
lua_pushnumber(lua,REDIS_NOTICE); lua_pushnumber(lua,LL_NOTICE);
lua_settable(lua,-3); lua_settable(lua,-3);
lua_pushstring(lua,"LOG_WARNING"); lua_pushstring(lua,"LL_WARNING");
lua_pushnumber(lua,REDIS_WARNING); lua_pushnumber(lua,LL_WARNING);
lua_settable(lua,-3); lua_settable(lua,-3);
/* redis.sha1hex */ /* redis.sha1hex */
...@@ -752,7 +752,7 @@ void scriptingInit(void) { ...@@ -752,7 +752,7 @@ void scriptingInit(void) {
* by scriptingReset(). */ * by scriptingReset(). */
if (server.lua_client == NULL) { if (server.lua_client == NULL) {
server.lua_client = createClient(-1); server.lua_client = createClient(-1);
server.lua_client->flags |= REDIS_LUA_CLIENT; server.lua_client->flags |= CLIENT_LUA;
} }
/* Lua beginners often don't use "local", this is likely to introduce /* Lua beginners often don't use "local", this is likely to introduce
...@@ -1085,7 +1085,7 @@ void evalGenericCommand(client *c, int evalsha) { ...@@ -1085,7 +1085,7 @@ void evalGenericCommand(client *c, int evalsha) {
rewriteClientCommandArgument(c,0, rewriteClientCommandArgument(c,0,
resetRefCount(createStringObject("EVAL",4))); resetRefCount(createStringObject("EVAL",4)));
rewriteClientCommandArgument(c,1,script); rewriteClientCommandArgument(c,1,script);
forceCommandPropagation(c,REDIS_PROPAGATE_REPL|REDIS_PROPAGATE_AOF); forceCommandPropagation(c,PROPAGATE_REPL|PROPAGATE_AOF);
} }
} }
} }
...@@ -1182,7 +1182,7 @@ void scriptCommand(client *c) { ...@@ -1182,7 +1182,7 @@ void scriptCommand(client *c) {
} }
addReplyBulkCBuffer(c,funcname+2,40); addReplyBulkCBuffer(c,funcname+2,40);
sdsfree(sha); sdsfree(sha);
forceCommandPropagation(c,REDIS_PROPAGATE_REPL|REDIS_PROPAGATE_AOF); forceCommandPropagation(c,PROPAGATE_REPL|PROPAGATE_AOF);
} else if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"kill")) { } else if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"kill")) {
if (server.lua_caller == NULL) { if (server.lua_caller == NULL) {
addReplySds(c,sdsnew("-NOTBUSY No scripts in execution right now.\r\n")); addReplySds(c,sdsnew("-NOTBUSY No scripts in execution right now.\r\n"));
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -267,7 +267,7 @@ void sortCommand(client *c) { ...@@ -267,7 +267,7 @@ void sortCommand(client *c) {
break; break;
} }
listAddNodeTail(operations,createSortOperation( listAddNodeTail(operations,createSortOperation(
REDIS_SORT_GET,c->argv[j+1])); SORT_OP_GET,c->argv[j+1]));
getop++; getop++;
j++; j++;
} else { } else {
...@@ -293,7 +293,7 @@ void sortCommand(client *c) { ...@@ -293,7 +293,7 @@ void sortCommand(client *c) {
* scripting and replication. */ * scripting and replication. */
if (dontsort && if (dontsort &&
sortval->type == OBJ_SET && sortval->type == OBJ_SET &&
(storekey || c->flags & REDIS_LUA_CLIENT)) (storekey || c->flags & CLIENT_LUA))
{ {
/* Force ALPHA sorting */ /* Force ALPHA sorting */
dontsort = 0; dontsort = 0;
...@@ -310,7 +310,7 @@ void sortCommand(client *c) { ...@@ -310,7 +310,7 @@ void sortCommand(client *c) {
case OBJ_LIST: vectorlen = listTypeLength(sortval); break; case OBJ_LIST: vectorlen = listTypeLength(sortval); break;
case OBJ_SET: vectorlen = setTypeSize(sortval); break; case OBJ_SET: vectorlen = setTypeSize(sortval); break;
case OBJ_ZSET: vectorlen = dictSize(((zset*)sortval->ptr)->dict); break; case OBJ_ZSET: vectorlen = dictSize(((zset*)sortval->ptr)->dict); break;
default: vectorlen = 0; redisPanic("Bad SORT type"); /* Avoid GCC warning */ default: vectorlen = 0; serverPanic("Bad SORT type"); /* Avoid GCC warning */
} }
/* Perform LIMIT start,count sanity checking. */ /* Perform LIMIT start,count sanity checking. */
...@@ -355,7 +355,7 @@ void sortCommand(client *c) { ...@@ -355,7 +355,7 @@ void sortCommand(client *c) {
listTypeEntry entry; listTypeEntry entry;
li = listTypeInitIterator(sortval, li = listTypeInitIterator(sortval,
desc ? (long)(listTypeLength(sortval) - start - 1) : start, desc ? (long)(listTypeLength(sortval) - start - 1) : start,
desc ? REDIS_HEAD : REDIS_TAIL); desc ? LIST_HEAD : LIST_TAIL);
while(j < vectorlen && listTypeNext(li,&entry)) { while(j < vectorlen && listTypeNext(li,&entry)) {
vector[j].obj = listTypeGet(&entry); vector[j].obj = listTypeGet(&entry);
...@@ -369,7 +369,7 @@ void sortCommand(client *c) { ...@@ -369,7 +369,7 @@ void sortCommand(client *c) {
start = 0; start = 0;
} }
} else if (sortval->type == OBJ_LIST) { } else if (sortval->type == OBJ_LIST) {
listTypeIterator *li = listTypeInitIterator(sortval,0,REDIS_TAIL); listTypeIterator *li = listTypeInitIterator(sortval,0,LIST_TAIL);
listTypeEntry entry; listTypeEntry entry;
while(listTypeNext(li,&entry)) { while(listTypeNext(li,&entry)) {
vector[j].obj = listTypeGet(&entry); vector[j].obj = listTypeGet(&entry);
...@@ -440,7 +440,7 @@ void sortCommand(client *c) { ...@@ -440,7 +440,7 @@ void sortCommand(client *c) {
} }
dictReleaseIterator(di); dictReleaseIterator(di);
} else { } else {
redisPanic("Unknown type"); serverPanic("Unknown type");
} }
serverAssertWithInfo(c,sortval,j == vectorlen); serverAssertWithInfo(c,sortval,j == vectorlen);
...@@ -517,7 +517,7 @@ void sortCommand(client *c) { ...@@ -517,7 +517,7 @@ void sortCommand(client *c) {
robj *val = lookupKeyByPattern(c->db,sop->pattern, robj *val = lookupKeyByPattern(c->db,sop->pattern,
vector[j].obj); vector[j].obj);
if (sop->type == REDIS_SORT_GET) { if (sop->type == SORT_OP_GET) {
if (!val) { if (!val) {
addReply(c,shared.nullbulk); addReply(c,shared.nullbulk);
} else { } else {
...@@ -526,7 +526,7 @@ void sortCommand(client *c) { ...@@ -526,7 +526,7 @@ void sortCommand(client *c) {
} }
} else { } else {
/* Always fails */ /* Always fails */
serverAssertWithInfo(c,sortval,sop->type == REDIS_SORT_GET); serverAssertWithInfo(c,sortval,sop->type == SORT_OP_GET);
} }
} }
} }
...@@ -539,7 +539,7 @@ void sortCommand(client *c) { ...@@ -539,7 +539,7 @@ void sortCommand(client *c) {
listIter li; listIter li;
if (!getop) { if (!getop) {
listTypePush(sobj,vector[j].obj,REDIS_TAIL); listTypePush(sobj,vector[j].obj,LIST_TAIL);
} else { } else {
listRewind(operations,&li); listRewind(operations,&li);
while((ln = listNext(&li))) { while((ln = listNext(&li))) {
...@@ -547,29 +547,29 @@ void sortCommand(client *c) { ...@@ -547,29 +547,29 @@ void sortCommand(client *c) {
robj *val = lookupKeyByPattern(c->db,sop->pattern, robj *val = lookupKeyByPattern(c->db,sop->pattern,
vector[j].obj); vector[j].obj);
if (sop->type == REDIS_SORT_GET) { if (sop->type == SORT_OP_GET) {
if (!val) val = createStringObject("",0); if (!val) val = createStringObject("",0);
/* listTypePush does an incrRefCount, so we should take care /* listTypePush does an incrRefCount, so we should take care
* care of the incremented refcount caused by either * care of the incremented refcount caused by either
* lookupKeyByPattern or createStringObject("",0) */ * lookupKeyByPattern or createStringObject("",0) */
listTypePush(sobj,val,REDIS_TAIL); listTypePush(sobj,val,LIST_TAIL);
decrRefCount(val); decrRefCount(val);
} else { } else {
/* Always fails */ /* Always fails */
serverAssertWithInfo(c,sortval,sop->type == REDIS_SORT_GET); serverAssertWithInfo(c,sortval,sop->type == SORT_OP_GET);
} }
} }
} }
} }
if (outputlen) { if (outputlen) {
setKey(c->db,storekey,sobj); setKey(c->db,storekey,sobj);
notifyKeyspaceEvent(REDIS_NOTIFY_LIST,"sortstore",storekey, notifyKeyspaceEvent(NOTIFY_LIST,"sortstore",storekey,
c->db->id); c->db->id);
server.dirty += outputlen; server.dirty += outputlen;
} else if (dbDelete(c->db,storekey)) { } else if (dbDelete(c->db,storekey)) {
signalModifiedKey(c->db,storekey); signalModifiedKey(c->db,storekey);
notifyKeyspaceEvent(REDIS_NOTIFY_GENERIC,"del",storekey,c->db->id); notifyKeyspaceEvent(NOTIFY_GENERIC,"del",storekey,c->db->id);
server.dirty++; server.dirty++;
} }
decrRefCount(sobj); decrRefCount(sobj);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -86,8 +86,8 @@ void setGenericCommand(client *c, int flags, robj *key, robj *val, robj *expire, ...@@ -86,8 +86,8 @@ void setGenericCommand(client *c, int flags, robj *key, robj *val, robj *expire,
setKey(c->db,key,val); setKey(c->db,key,val);
server.dirty++; server.dirty++;
if (expire) setExpire(c->db,key,mstime()+milliseconds); if (expire) setExpire(c->db,key,mstime()+milliseconds);
notifyKeyspaceEvent(REDIS_NOTIFY_STRING,"set",key,c->db->id); notifyKeyspaceEvent(NOTIFY_STRING,"set",key,c->db->id);
if (expire) notifyKeyspaceEvent(REDIS_NOTIFY_GENERIC, if (expire) notifyKeyspaceEvent(NOTIFY_GENERIC,
"expire",key,c->db->id); "expire",key,c->db->id);
addReply(c, ok_reply ? ok_reply : shared.ok); addReply(c, ok_reply ? ok_reply : shared.ok);
} }
...@@ -177,7 +177,7 @@ void getsetCommand(client *c) { ...@@ -177,7 +177,7 @@ void getsetCommand(client *c) {
if (getGenericCommand(c) == C_ERR) return; if (getGenericCommand(c) == C_ERR) return;
c->argv[2] = tryObjectEncoding(c->argv[2]); c->argv[2] = tryObjectEncoding(c->argv[2]);
setKey(c->db,c->argv[1],c->argv[2]); setKey(c->db,c->argv[1],c->argv[2]);
notifyKeyspaceEvent(REDIS_NOTIFY_STRING,"set",c->argv[1],c->db->id); notifyKeyspaceEvent(NOTIFY_STRING,"set",c->argv[1],c->db->id);
server.dirty++; server.dirty++;
} }
...@@ -234,7 +234,7 @@ void setrangeCommand(client *c) { ...@@ -234,7 +234,7 @@ void setrangeCommand(client *c) {
o->ptr = sdsgrowzero(o->ptr,offset+sdslen(value)); o->ptr = sdsgrowzero(o->ptr,offset+sdslen(value));
memcpy((char*)o->ptr+offset,value,sdslen(value)); memcpy((char*)o->ptr+offset,value,sdslen(value));
signalModifiedKey(c->db,c->argv[1]); signalModifiedKey(c->db,c->argv[1]);
notifyKeyspaceEvent(REDIS_NOTIFY_STRING, notifyKeyspaceEvent(NOTIFY_STRING,
"setrange",c->argv[1],c->db->id); "setrange",c->argv[1],c->db->id);
server.dirty++; server.dirty++;
} }
...@@ -320,7 +320,7 @@ void msetGenericCommand(client *c, int nx) { ...@@ -320,7 +320,7 @@ void msetGenericCommand(client *c, int nx) {
for (j = 1; j < c->argc; j += 2) { for (j = 1; j < c->argc; j += 2) {
c->argv[j+1] = tryObjectEncoding(c->argv[j+1]); c->argv[j+1] = tryObjectEncoding(c->argv[j+1]);
setKey(c->db,c->argv[j],c->argv[j+1]); setKey(c->db,c->argv[j],c->argv[j+1]);
notifyKeyspaceEvent(REDIS_NOTIFY_STRING,"set",c->argv[j],c->db->id); notifyKeyspaceEvent(NOTIFY_STRING,"set",c->argv[j],c->db->id);
} }
server.dirty += (c->argc-1)/2; server.dirty += (c->argc-1)/2;
addReply(c, nx ? shared.cone : shared.ok); addReply(c, nx ? shared.cone : shared.ok);
...@@ -351,7 +351,7 @@ void incrDecrCommand(client *c, long long incr) { ...@@ -351,7 +351,7 @@ void incrDecrCommand(client *c, long long incr) {
value += incr; value += incr;
if (o && o->refcount == 1 && o->encoding == OBJ_ENCODING_INT && if (o && o->refcount == 1 && o->encoding == OBJ_ENCODING_INT &&
(value < 0 || value >= REDIS_SHARED_INTEGERS) && (value < 0 || value >= OBJ_SHARED_INTEGERS) &&
value >= LONG_MIN && value <= LONG_MAX) value >= LONG_MIN && value <= LONG_MAX)
{ {
new = o; new = o;
...@@ -365,7 +365,7 @@ void incrDecrCommand(client *c, long long incr) { ...@@ -365,7 +365,7 @@ void incrDecrCommand(client *c, long long incr) {
} }
} }
signalModifiedKey(c->db,c->argv[1]); signalModifiedKey(c->db,c->argv[1]);
notifyKeyspaceEvent(REDIS_NOTIFY_STRING,"incrby",c->argv[1],c->db->id); notifyKeyspaceEvent(NOTIFY_STRING,"incrby",c->argv[1],c->db->id);
server.dirty++; server.dirty++;
addReply(c,shared.colon); addReply(c,shared.colon);
addReply(c,new); addReply(c,new);
...@@ -415,7 +415,7 @@ void incrbyfloatCommand(client *c) { ...@@ -415,7 +415,7 @@ void incrbyfloatCommand(client *c) {
else else
dbAdd(c->db,c->argv[1],new); dbAdd(c->db,c->argv[1],new);
signalModifiedKey(c->db,c->argv[1]); signalModifiedKey(c->db,c->argv[1]);
notifyKeyspaceEvent(REDIS_NOTIFY_STRING,"incrbyfloat",c->argv[1],c->db->id); notifyKeyspaceEvent(NOTIFY_STRING,"incrbyfloat",c->argv[1],c->db->id);
server.dirty++; server.dirty++;
addReplyBulk(c,new); addReplyBulk(c,new);
...@@ -456,7 +456,7 @@ void appendCommand(client *c) { ...@@ -456,7 +456,7 @@ void appendCommand(client *c) {
totlen = sdslen(o->ptr); totlen = sdslen(o->ptr);
} }
signalModifiedKey(c->db,c->argv[1]); signalModifiedKey(c->db,c->argv[1]);
notifyKeyspaceEvent(REDIS_NOTIFY_STRING,"append",c->argv[1],c->db->id); notifyKeyspaceEvent(NOTIFY_STRING,"append",c->argv[1],c->db->id);
server.dirty++; server.dirty++;
addReplyLongLong(c,totlen); addReplyLongLong(c,totlen);
} }
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment