MCPcopy Create free account
hub / github.com/apache/mesos / execute

Method execute

src/log/tool/replica.cpp:65–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64
65Try<Nothing> Replica::execute(int argc, char** argv)
66{
67 flags.setUsageMessage(
68 "Usage: " + name() + " [options]\n"
69 "\n"
70 "This command is used to start a replica server.\n"
71 "\n");
72
73 // Configure the tool by parsing command line arguments.
74 if (argc > 0 && argv != nullptr) {
75 Try<flags::Warnings> load = flags.load(None(), argc, argv);
76 if (load.isError()) {
77 return Error(flags.usage(load.error()));
78 }
79
80 if (flags.help) {
81 return Error(flags.usage());
82 }
83
84 process::initialize();
85 logging::initialize(argv[0], false, flags);
86
87 // Log any flag warnings (after logging is initialized).
88 foreach (const flags::Warning& warning, load->warnings) {
89 LOG(WARNING) << warning.message;
90 }
91 }
92
93 if (flags.quorum.isNone()) {
94 return Error(flags.usage("Missing required option --quorum"));
95 }
96
97 if (flags.path.isNone()) {
98 return Error(flags.usage("Missing required option --path"));
99 }
100
101 if (flags.servers.isNone()) {
102 return Error(flags.usage("Missing required option --servers"));
103 }
104
105 if (flags.znode.isNone()) {
106 return Error(flags.usage("Missing required option --znode"));
107 }
108
109 // Initialize the log.
110 if (flags.initialize) {
111 Initialize initialize;
112 initialize.flags.path = flags.path;
113
114 Try<Nothing> execution = initialize.execute();
115 if (execution.isError()) {
116 return Error(execution.error());
117 }
118 }
119
120 // Create the log.
121 Log log(
122 flags.quorum.get(),

Callers

nothing calls this directly

Calls 13

nameFunction · 0.85
NoneClass · 0.85
SecondsClass · 0.85
NothingClass · 0.85
setUsageMessageMethod · 0.80
errorMethod · 0.65
ErrorFunction · 0.50
initializeFunction · 0.50
loadMethod · 0.45
isErrorMethod · 0.45
usageMethod · 0.45
isNoneMethod · 0.45

Tested by

no test coverage detected