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

Function sentinelInstanceMapCommand

app/redis-6.2.6/src/sentinel.c:1736–1742  ·  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

1734 * to the set of renamed commands. However, if the command was not renamed,
1735 * we just return "command" itself. */
1736char *sentinelInstanceMapCommand(sentinelRedisInstance *ri, char *command) {
1737 sds sc = sdsnew(command);
1738 if (ri->master) ri = ri->master;
1739 char *retval = dictFetchValue(ri->renamed_commands, sc);
1740 sdsfree(sc);
1741 return retval ? retval : command;
1742}
1743
1744/* ============================ Config handling ============================= */
1745

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