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

Function populateCommandTable

app/redis-6.2.6/src/server.c:3449–3469  ·  view source on GitHub ↗

Populates the Redis Command Table starting from the hard coded list * we have on top of server.c file. */

Source from the content-addressed store, hash-verified

3447/* Populates the Redis Command Table starting from the hard coded list
3448 * we have on top of server.c file. */
3449void populateCommandTable(void) {
3450 int j;
3451 int numcommands = sizeof(redisCommandTable)/sizeof(struct redisCommand);
3452
3453 for (j = 0; j < numcommands; j++) {
3454 struct redisCommand *c = redisCommandTable+j;
3455 int retval1, retval2;
3456
3457 /* Translate the command string flags description into an actual
3458 * set of flags. */
3459 if (populateCommandTableParseFlags(c,c->sflags) == C_ERR)
3460 serverPanic("Unsupported command flag");
3461
3462 c->id = ACLGetCommandID(c->name); /* Assign the ID used for ACL. */
3463 retval1 = dictAdd(server.commands, sdsnew(c->name), c);
3464 /* Populate an additional dictionary that will be unaffected
3465 * by rename-command statements in redis.conf. */
3466 retval2 = dictAdd(server.orig_commands, sdsnew(c->name), c);
3467 serverAssert(retval1 == DICT_OK && retval2 == DICT_OK);
3468 }
3469}
3470
3471void resetCommandTableStats(void) {
3472 struct redisCommand *c;

Callers 1

initServerConfigFunction · 0.85

Calls 4

ACLGetCommandIDFunction · 0.85
sdsnewFunction · 0.85
dictAddFunction · 0.70

Tested by

no test coverage detected