redis.set_repl() * * Set the propagation of write commands executed in the context of the * script to on/off for AOF and slaves. */
| 976 | * Set the propagation of write commands executed in the context of the |
| 977 | * script to on/off for AOF and slaves. */ |
| 978 | int 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() */ |
| 1000 | int luaLogCommand(lua_State *lua) { |
nothing calls this directly
no test coverage detected