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

Method fetchData

gpcontrib/gpcloud/src/s3interface.cpp:340–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340uint64_t S3InterfaceService::fetchData(uint64_t offset, S3VectorUInt8 &data, uint64_t len,
341 const S3Url &s3Url) {
342 HTTPHeaders headers;
343
344 char rangeBuf[S3_RANGE_HEADER_STRING_LEN] = {0};
345 snprintf(rangeBuf, sizeof(rangeBuf), "bytes=%" PRIu64 "-%" PRIu64, offset, offset + len - 1);
346 headers.Add(HOST, s3Url.getHostForCurl());
347 headers.Add(RANGE, rangeBuf);
348 headers.Add(X_AMZ_CONTENT_SHA256,
349 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); // sha256hex
350 // of empty
351 // string
352
353 SignRequestV4("GET", &headers, s3Url.getRegion(), s3Url.getPathForCurl(), "",
354 this->params.getCred());
355
356 Response resp = this->getResponseWithRetries(s3Url.getFullUrlForCurl(), headers);
357 if (resp.getStatus() == RESPONSE_OK) {
358 data.swap(resp.getRawData());
359 S3_CHECK_OR_DIE(data.size() == len, S3PartialResponseError, len, data.size());
360 return data.size();
361 } else if (resp.getStatus() == RESPONSE_ERROR) {
362 S3MessageParser s3msg(resp);
363 S3_DIE(S3LogicError, s3msg.getCode(), s3msg.getMessage());
364 } else {
365 S3_DIE(S3RuntimeError, "unexpected response status");
366 }
367}
368
369S3CompressionType S3InterfaceService::checkCompressionType(const S3Url &s3Url) {
370 string ext = s3Url.getExtension();

Callers 2

TEST_FFunction · 0.80
fillMethod · 0.80

Calls 11

SignRequestV4Function · 0.85
getHostForCurlMethod · 0.80
getPathForCurlMethod · 0.80
getFullUrlForCurlMethod · 0.80
getStatusMethod · 0.80
AddMethod · 0.45
getRawDataMethod · 0.45
sizeMethod · 0.45
getCodeMethod · 0.45
getMessageMethod · 0.45

Tested by 1

TEST_FFunction · 0.64