MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaRedisSetReplCommand

Function luaRedisSetReplCommand

app/redis-6.2.6/src/scripting.c:964–983  ·  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

962 * Set the propagation of write commands executed in the context of the
963 * script to on/off for AOF and slaves. */
964int 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() */
986int luaLogCommand(lua_State *lua) {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected