MCPcopy Create free account
hub / github.com/apache/incubator-pegasus / remote_command

Function remote_command

src/shell/commands/node_management.cpp:511–626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

509}
510
511bool remote_command(command_executor *e, shell_context *sc, arguments args)
512{
513 static struct option long_options[] = {{"node_type", required_argument, 0, 't'},
514 {"node_list", required_argument, 0, 'l'},
515 {"resolve_ip", no_argument, 0, 'r'},
516 {0, 0, 0, 0}};
517
518 std::string type;
519 std::string nodes;
520 optind = 0;
521 bool resolve_ip = false;
522 while (true) {
523 int option_index = 0;
524 int c;
525 c = getopt_long(args.argc, args.argv, "t:l:r", long_options, &option_index);
526 if (c == -1)
527 break;
528 switch (c) {
529 case 't':
530 type = optarg;
531 break;
532 case 'l':
533 nodes = optarg;
534 break;
535 case 'r':
536 resolve_ip = true;
537 break;
538 default:
539 return false;
540 }
541 }
542
543 if (!type.empty() && !nodes.empty()) {
544 fprintf(stderr, "can not specify both node_type and node_list\n");
545 return false;
546 }
547
548 if (type.empty() && nodes.empty()) {
549 type = "all";
550 }
551
552 if (!type.empty() && type != "all" && type != "meta-server" && type != "replica-server") {
553 fprintf(stderr, "invalid type, should be: all | meta-server | replica-server\n");
554 return false;
555 }
556
557 if (optind == args.argc) {
558 fprintf(stderr, "command not specified\n");
559 return false;
560 }
561
562 std::string cmd = args.argv[optind];
563 std::vector<std::string> arguments;
564 for (int i = optind + 1; i < args.argc; i++) {
565 arguments.push_back(args.argv[i]);
566 }
567
568 std::vector<node_desc> node_list;

Callers 3

server_infoFunction · 0.85
server_statFunction · 0.85
flush_logFunction · 0.85

Calls 8

fill_nodesFunction · 0.85
split_argsFunction · 0.85
call_remote_commandFunction · 0.85
hostname_from_ip_portFunction · 0.85
from_string_ipv4Method · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected