MCPcopy Create free account
hub / github.com/apple/foundationdb / string> beginMultiPartUpload_impl

Method string> beginMultiPartUpload_impl

fdbclient/S3BlobStore.actor.cpp:1637–1667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1635}
1636
1637ACTOR static Future<std::string> beginMultiPartUpload_impl(Reference<S3BlobStoreEndpoint> bstore,
1638 std::string bucket,
1639 std::string object) {
1640 wait(bstore->requestRateWrite->getAllowance(1));
1641
1642 std::string resource = constructResourcePath(bstore, bucket, object);
1643 resource += "?uploads";
1644 HTTP::Headers headers;
1645 if (!CLIENT_KNOBS->BLOBSTORE_ENCRYPTION_TYPE.empty())
1646 headers["x-amz-server-side-encryption"] = CLIENT_KNOBS->BLOBSTORE_ENCRYPTION_TYPE;
1647 Reference<HTTP::Response> r = wait(bstore->doRequest("POST", resource, headers, nullptr, 0, { 200 }));
1648
1649 try {
1650 xml_document<> doc;
1651 // Copy content because rapidxml will modify it during parse
1652 std::string content = r->content;
1653
1654 doc.parse<0>((char*)content.c_str());
1655
1656 // There should be exactly one node
1657 xml_node<>* result = doc.first_node();
1658 if (result != nullptr && strcmp(result->name(), "InitiateMultipartUploadResult") == 0) {
1659 xml_node<>* id = result->first_node("UploadId");
1660 if (id != nullptr) {
1661 return id->value();
1662 }
1663 }
1664 } catch (...) {
1665 }
1666 throw http_bad_response();
1667}
1668
1669Future<std::string> S3BlobStoreEndpoint::beginMultiPartUpload(std::string const& bucket, std::string const& object) {
1670 return beginMultiPartUpload_impl(Reference<S3BlobStoreEndpoint>::addRef(this), bucket, object);

Callers

nothing calls this directly

Calls 8

constructResourcePathFunction · 0.85
doRequestMethod · 0.80
first_nodeMethod · 0.80
nameMethod · 0.65
getAllowanceMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected