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

Function luaRedisSetReplCommand

src/scripting.cpp:978–997  ·  view source on GitHub ↗

redis.set_repl() * * Set the propagation of write commands executed in the context of the * script to on/off for AOF and slaves. */

Source from the content-addressed store, hash-verified

976 * Set the propagation of write commands executed in the context of the
977 * script to on/off for AOF and slaves. */
978int luaRedisSetReplCommand(lua_State *lua) {
979 int argc = lua_gettop(lua);
980 int flags;
981
982 if (g_pserver->lua_replicate_commands == 0) {
983 lua_pushstring(lua, "You can set the replication behavior only after turning on single commands replication with redis.replicate_commands().");
984 return lua_error(lua);
985 } else if (argc != 1) {
986 lua_pushstring(lua, "redis.set_repl() requires two arguments.");
987 return lua_error(lua);
988 }
989
990 flags = lua_tonumber(lua,-1);
991 if ((flags & ~(PROPAGATE_AOF|PROPAGATE_REPL)) != 0) {
992 lua_pushstring(lua, "Invalid replication flags. Use REPL_AOF, REPL_REPLICA, REPL_ALL or REPL_NONE.");
993 return lua_error(lua);
994 }
995 g_pserver->lua_repl = flags;
996 return 0;
997}
998
999/* redis.log() */
1000int luaLogCommand(lua_State *lua) {

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.85
lua_pushstringFunction · 0.85
lua_errorFunction · 0.85
lua_tonumberFunction · 0.85

Tested by

no test coverage detected