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

Function sentinelInstanceMapCommand

src/sentinel.cpp:1742–1748  ·  view source on GitHub ↗

This function is used in order to send commands to Redis instances: the * commands we send from Sentinel may be renamed, a common case is a master * with CONFIG and SLAVEOF commands renamed for security concerns. In that * case we check the ri->renamed_command table (or if the instance is a slave, * we check the one of the master), and map the command that we should send * to the set of renam

Source from the content-addressed store, hash-verified

1740 * to the set of renamed commands. However, if the command was not renamed,
1741 * we just return "command" itself. */
1742const char *sentinelInstanceMapCommand(sentinelRedisInstance *ri, const char *command) {
1743 sds sc = sdsnew(command);
1744 if (ri->master) ri = ri->master;
1745 char *retval = (char*)dictFetchValue(ri->renamed_commands, sc);
1746 sdsfree(sc);
1747 return retval ? retval : command;
1748}
1749
1750/* ============================ Config handling ============================= */
1751

Callers 9

sentinelSendAuthIfNeededFunction · 0.85
sentinelSetClientNameFunction · 0.85
sentinelSendHelloFunction · 0.85
sentinelSendPingFunction · 0.85
sentinelSendSlaveOfFunction · 0.85

Calls 3

sdsnewFunction · 0.85
dictFetchValueFunction · 0.85
sdsfreeFunction · 0.85

Tested by

no test coverage detected