redis.set_repl() * * Set the propagation of write commands executed in the context of the * script to on/off for AOF and slaves. */
| 962 | * Set the propagation of write commands executed in the context of the |
| 963 | * script to on/off for AOF and slaves. */ |
| 964 | int luaRedisSetReplCommand(lua_State *lua) { |
| 965 | int argc = lua_gettop(lua); |
| 966 | int flags; |
| 967 | |
| 968 | if (server.lua_replicate_commands == 0) { |
| 969 | lua_pushstring(lua, "You can set the replication behavior only after turning on single commands replication with redis.replicate_commands()."); |
| 970 | return lua_error(lua); |
| 971 | } else if (argc != 1) { |
| 972 | lua_pushstring(lua, "redis.set_repl() requires two arguments."); |
| 973 | return lua_error(lua); |
| 974 | } |
| 975 | |
| 976 | flags = lua_tonumber(lua,-1); |
| 977 | if ((flags & ~(PROPAGATE_AOF|PROPAGATE_REPL)) != 0) { |
| 978 | lua_pushstring(lua, "Invalid replication flags. Use REPL_AOF, REPL_REPLICA, REPL_ALL or REPL_NONE."); |
| 979 | return lua_error(lua); |
| 980 | } |
| 981 | server.lua_repl = flags; |
| 982 | return 0; |
| 983 | } |
| 984 | |
| 985 | /* redis.log() */ |
| 986 | int luaLogCommand(lua_State *lua) { |
nothing calls this directly
no test coverage detected