Redis instance to Redis protocol representation. */
| 3264 | |
| 3265 | /* Redis instance to Redis protocol representation. */ |
| 3266 | void addReplySentinelRedisInstance(client *c, sentinelRedisInstance *ri) { |
| 3267 | char *flags = sdsempty(); |
| 3268 | void *mbl; |
| 3269 | int fields = 0; |
| 3270 | |
| 3271 | mbl = addReplyDeferredLen(c); |
| 3272 | |
| 3273 | addReplyBulkCString(c,"name"); |
| 3274 | addReplyBulkCString(c,ri->name); |
| 3275 | fields++; |
| 3276 | |
| 3277 | addReplyBulkCString(c,"ip"); |
| 3278 | addReplyBulkCString(c,announceSentinelAddr(ri->addr)); |
| 3279 | fields++; |
| 3280 | |
| 3281 | addReplyBulkCString(c,"port"); |
| 3282 | addReplyBulkLongLong(c,ri->addr->port); |
| 3283 | fields++; |
| 3284 | |
| 3285 | addReplyBulkCString(c,"runid"); |
| 3286 | addReplyBulkCString(c,ri->runid ? ri->runid : ""); |
| 3287 | fields++; |
| 3288 | |
| 3289 | addReplyBulkCString(c,"flags"); |
| 3290 | if (ri->flags & SRI_S_DOWN) flags = sdscat(flags,"s_down,"); |
| 3291 | if (ri->flags & SRI_O_DOWN) flags = sdscat(flags,"o_down,"); |
| 3292 | if (ri->flags & SRI_MASTER) flags = sdscat(flags,"master,"); |
| 3293 | if (ri->flags & SRI_SLAVE) flags = sdscat(flags,"slave,"); |
| 3294 | if (ri->flags & SRI_SENTINEL) flags = sdscat(flags,"sentinel,"); |
| 3295 | if (ri->link->disconnected) flags = sdscat(flags,"disconnected,"); |
| 3296 | if (ri->flags & SRI_MASTER_DOWN) flags = sdscat(flags,"master_down,"); |
| 3297 | if (ri->flags & SRI_FAILOVER_IN_PROGRESS) |
| 3298 | flags = sdscat(flags,"failover_in_progress,"); |
| 3299 | if (ri->flags & SRI_PROMOTED) flags = sdscat(flags,"promoted,"); |
| 3300 | if (ri->flags & SRI_RECONF_SENT) flags = sdscat(flags,"reconf_sent,"); |
| 3301 | if (ri->flags & SRI_RECONF_INPROG) flags = sdscat(flags,"reconf_inprog,"); |
| 3302 | if (ri->flags & SRI_RECONF_DONE) flags = sdscat(flags,"reconf_done,"); |
| 3303 | if (ri->flags & SRI_FORCE_FAILOVER) flags = sdscat(flags,"force_failover,"); |
| 3304 | if (ri->flags & SRI_SCRIPT_KILL_SENT) flags = sdscat(flags,"script_kill_sent,"); |
| 3305 | |
| 3306 | if (sdslen(flags) != 0) sdsrange(flags,0,-2); /* remove last "," */ |
| 3307 | addReplyBulkCString(c,flags); |
| 3308 | sdsfree(flags); |
| 3309 | fields++; |
| 3310 | |
| 3311 | addReplyBulkCString(c,"link-pending-commands"); |
| 3312 | addReplyBulkLongLong(c,ri->link->pending_commands); |
| 3313 | fields++; |
| 3314 | |
| 3315 | addReplyBulkCString(c,"link-refcount"); |
| 3316 | addReplyBulkLongLong(c,ri->link->refcount); |
| 3317 | fields++; |
| 3318 | |
| 3319 | if (ri->flags & SRI_FAILOVER_IN_PROGRESS) { |
| 3320 | addReplyBulkCString(c,"failover-state"); |
| 3321 | addReplyBulkCString(c,(char*)sentinelFailoverStateStr(ri->failover_state)); |
| 3322 | fields++; |
| 3323 | } |
no test coverage detected