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

Function clusterManagerNodeByName

app/redis-6.2.6/src/redis-cli.c:2870–2888  ·  view source on GitHub ↗

Return the node with the specified name (ID) or NULL. */

Source from the content-addressed store, hash-verified

2868
2869/* Return the node with the specified name (ID) or NULL. */
2870static clusterManagerNode *clusterManagerNodeByName(const char *name) {
2871 if (cluster_manager.nodes == NULL) return NULL;
2872 clusterManagerNode *found = NULL;
2873 sds lcname = sdsempty();
2874 lcname = sdscpy(lcname, name);
2875 sdstolower(lcname);
2876 listIter li;
2877 listNode *ln;
2878 listRewind(cluster_manager.nodes, &li);
2879 while ((ln = listNext(&li)) != NULL) {
2880 clusterManagerNode *n = ln->value;
2881 if (n->name && !sdscmp(n->name, lcname)) {
2882 found = n;
2883 break;
2884 }
2885 }
2886 sdsfree(lcname);
2887 return found;
2888}
2889
2890/* Like clusterManagerNodeByName but the specified name can be just the first
2891 * part of the node ID as long as the prefix in unique across the

Calls 7

sdsemptyFunction · 0.85
sdscpyFunction · 0.85
sdstolowerFunction · 0.85
listRewindFunction · 0.85
listNextFunction · 0.85
sdscmpFunction · 0.85
sdsfreeFunction · 0.85

Tested by

no test coverage detected