namespace gcs = google::cloud::storage;
using ::google::cloud::StatusOr;
auto client_options =
gcs::ClientOptions::CreateDefaultClientOptions();
auto client = gcs::internal::CurlClient::Create(*client_options);
StatusOr<std::unique_ptr<gcs::internal::ResumableUploadSession>> session;
std::uint64_t total_size = 0;
void performresumableupload(std::string& bucket_name,
std::string& object_name,
std::string& data, std::uint64_t data_size, bool isFinal) {
gcs::internal::ResumableUploadRequest request(bucket_name, object_name);
StatusOr<gcs::internal::ResumableUploadResponse> response;
total_size += data_size;
if (!isFinal) {
session = client->CreateResumableSession(request);
response = (*session)->UploadChunk(data);
}
else {
std::cout << "Uploading total size " << total_size << "\n";
response = (*session)->UploadFinalChunk(data, total_size);
}
std::cout << "Response Status: " << response.status() << "\n";
}
I'm using curlclient to upload a huge object in chunks of 5MB (a multiple of 256K) and it works. However, I'd like to be able to Cancel this operation and get rid of the partially uploaded chunks before UploadFinalChunk has been called and the object has been committed. From looking at the documentation here, I see that to cancel the resumable upload request, I would have to send a DELETE request. However, I don't see any method available in the CurlClient that will help me do the same. Appreciate any help.