| 375 | } |
| 376 | |
| 377 | bool redis_cluster::cluster_info(std::map<string, string>& result) |
| 378 | { |
| 379 | const char* argv[2]; |
| 380 | size_t lens[2]; |
| 381 | |
| 382 | argv[0] = "CLUSTER"; |
| 383 | lens[0] = sizeof("CLUSTER") - 1; |
| 384 | |
| 385 | argv[1] = "INFO"; |
| 386 | lens[1] = sizeof("INFO") - 1; |
| 387 | |
| 388 | build_request(2, argv, lens); |
| 389 | |
| 390 | string buf; |
| 391 | if (get_string(buf) <= 0) { |
| 392 | return false; |
| 393 | } |
| 394 | |
| 395 | string line; |
| 396 | |
| 397 | while (true) { |
| 398 | line.clear(); |
| 399 | if (!buf.scan_line(line)) { |
| 400 | break; |
| 401 | } |
| 402 | |
| 403 | char* name = line.c_str(); |
| 404 | char* value = strchr(name, ':'); |
| 405 | if (value == NULL || *(value + 1) == 0) { |
| 406 | continue; |
| 407 | } |
| 408 | *value++ = 0; |
| 409 | result[name] = value; |
| 410 | } |
| 411 | |
| 412 | return true; |
| 413 | } |
| 414 | |
| 415 | bool redis_cluster::cluster_saveconfig() |
| 416 | { |