MCPcopy Create free account
hub / github.com/apache/cloudberry / main

Function main

gpcontrib/gpcloud/bin/gpcheckcloud/gpcheckcloud.cpp:281–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281int main(int argc, char *argv[]) {
282 bool ret = true;
283
284 s3ext_loglevel = EXT_ERROR;
285 s3ext_logtype = STDERR_LOG;
286
287 if (argc == 1) {
288 printUsage(stderr);
289 exit(EXIT_FAILURE);
290 }
291
292 /* Prepare to receive interrupts */
293 registerSignalHandler();
294
295 map<char, string> optionPairs = parseCommandLineArgs(argc, argv);
296
297 validateCommandLineArgs(optionPairs);
298
299 if (!optionPairs.empty()) {
300 const char *arg = optionPairs.begin()->second.c_str();
301
302 switch (optionPairs.begin()->first) {
303 case 'c':
304 ret = checkConfig(arg);
305 break;
306 case 'd':
307 ret = downloadS3(arg);
308 break;
309 case 'u':
310 case 'f':
311 ret = uploadS3(optionPairs['u'].c_str(), optionPairs['f'].c_str());
312 break;
313 case 'h':
314 printUsage(stdout);
315 break;
316 case 't':
317 printTemplate();
318 break;
319 default:
320 printUsage(stderr);
321 exit(EXIT_FAILURE);
322 }
323 }
324
325 // Abort should not print the failed info
326 if (ret || S3QueryIsAbortInProgress()) {
327 exit(EXIT_SUCCESS);
328 } else {
329 fprintf(stderr, "Failed. Please check the arguments and configuration file.\n\n");
330 printUsage(stderr);
331 exit(EXIT_FAILURE);
332 }
333}

Callers

nothing calls this directly

Calls 10

printUsageFunction · 0.85
registerSignalHandlerFunction · 0.85
parseCommandLineArgsFunction · 0.85
validateCommandLineArgsFunction · 0.85
checkConfigFunction · 0.85
downloadS3Function · 0.85
uploadS3Function · 0.85
printTemplateFunction · 0.85
S3QueryIsAbortInProgressFunction · 0.70
beginMethod · 0.45

Tested by

no test coverage detected