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

Function GetOptS3

gpcontrib/gpcloud/src/s3utils.cpp:437–455  ·  view source on GitHub ↗

GetOptS3 returns first value according to given key. key=value pair are separated by whitespace.

Source from the content-addressed store, hash-verified

435// GetOptS3 returns first value according to given key.
436// key=value pair are separated by whitespace.
437string GetOptS3(const string &urlWithOptions, const string &key) {
438 string keyStr = " ";
439 keyStr += key;
440 keyStr += "=";
441
442 size_t beginIndex = urlWithOptions.find(keyStr);
443 if (beginIndex == urlWithOptions.npos) {
444 return "";
445 } else {
446 beginIndex += keyStr.length();
447 size_t endIndex = urlWithOptions.find(" ", beginIndex);
448
449 if (endIndex == urlWithOptions.npos) {
450 return urlWithOptions.substr(beginIndex);
451 } else {
452 return urlWithOptions.substr(beginIndex, endIndex - beginIndex);
453 }
454 }
455}
456
457// TruncateOptions truncates substring after first whitespace.
458string TruncateOptions(const string &urlWithOptions) {

Callers 2

TESTFunction · 0.85
InitConfigFunction · 0.85

Calls 2

findMethod · 0.80
lengthMethod · 0.80

Tested by 1

TESTFunction · 0.68