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

Function representClusterNodeFlags

app/redis-6.2.6/src/cluster.c:4153–4164  ·  view source on GitHub ↗

Concatenate the comma separated list of node flags to the given SDS * string 'ci'. */

Source from the content-addressed store, hash-verified

4151/* Concatenate the comma separated list of node flags to the given SDS
4152 * string 'ci'. */
4153sds representClusterNodeFlags(sds ci, uint16_t flags) {
4154 size_t orig_len = sdslen(ci);
4155 int i, size = sizeof(redisNodeFlagsTable)/sizeof(struct redisNodeFlags);
4156 for (i = 0; i < size; i++) {
4157 struct redisNodeFlags *nodeflag = redisNodeFlagsTable + i;
4158 if (flags & nodeflag->flag) ci = sdscat(ci, nodeflag->name);
4159 }
4160 /* If no flag was added, add the "noflags" special flag. */
4161 if (sdslen(ci) == orig_len) ci = sdscat(ci,"noflags,");
4162 sdsIncrLen(ci,-1); /* Remove trailing comma. */
4163 return ci;
4164}
4165
4166/* Generate a csv-alike representation of the specified cluster node.
4167 * See clusterGenNodesDescription() top comment for more information.

Callers 2

Calls 3

sdslenFunction · 0.85
sdscatFunction · 0.85
sdsIncrLenFunction · 0.85

Tested by

no test coverage detected