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

Function downloadS3

gpcontrib/gpcloud/bin/gpcheckcloud/gpcheckcloud.cpp:193–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193static bool downloadS3(const char *urlWithOptions) {
194 if (!urlWithOptions) {
195 return false;
196 }
197
198 int data_len = BUF_SIZE;
199 char data_buf[BUF_SIZE];
200 bool ret = true;
201
202 thread_setup();
203
204 GPReader *reader = reader_init(urlWithOptions);
205 if (!reader) {
206 return false;
207 }
208
209 strncpy(eolString, reader->getParams().getGpcheckcloud_newline().c_str(), EOL_CHARS_MAX_LEN);
210 eolString[EOL_CHARS_MAX_LEN] = '\0';
211
212 do {
213 data_len = BUF_SIZE;
214
215 if (!reader_transfer_data(reader, data_buf, data_len)) {
216 fprintf(stderr, "Failed to read data from Amazon S3\n");
217 ret = false;
218 break;
219 }
220
221 fwrite(data_buf, (size_t)data_len, 1, stdout);
222 } while (data_len && !S3QueryIsAbortInProgress());
223
224 reader_cleanup(&reader);
225
226 thread_cleanup();
227
228 return ret;
229}
230
231static bool uploadS3(const char *urlWithOptions, const char *fileToUpload) {
232 if (!urlWithOptions) {

Callers 1

mainFunction · 0.85

Calls 6

thread_setupFunction · 0.85
reader_initFunction · 0.85
reader_transfer_dataFunction · 0.85
reader_cleanupFunction · 0.85
thread_cleanupFunction · 0.85
S3QueryIsAbortInProgressFunction · 0.70

Tested by

no test coverage detected