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

Function representClusterNodeFlags

src/cluster.cpp:4212–4223  ·  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

4210/* Concatenate the comma separated list of node flags to the given SDS
4211 * string 'ci'. */
4212sds representClusterNodeFlags(sds ci, uint16_t flags) {
4213 size_t orig_len = sdslen(ci);
4214 int i, size = sizeof(redisNodeFlagsTable)/sizeof(struct redisNodeFlags);
4215 for (i = 0; i < size; i++) {
4216 struct redisNodeFlags *nodeflag = redisNodeFlagsTable + i;
4217 if (flags & nodeflag->flag) ci = sdscat(ci, nodeflag->name);
4218 }
4219 /* If no flag was added, add the "noflags" special flag. */
4220 if (sdslen(ci) == orig_len) ci = sdscat(ci,"noflags,");
4221 sdsIncrLen(ci,-1); /* Remove trailing comma. */
4222 return ci;
4223}
4224
4225/* Generate a csv-alike representation of the specified cluster node.
4226 * 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