mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Merge pull request #14376 from lovesegfault/nix-s3-abort-multipart
feat(libstore/s3-binary-cache-store): implement `abortMultipartUpload()`
This commit is contained in:
commit
ea17cc1b57
1 changed files with 21 additions and 0 deletions
|
|
@ -26,6 +26,14 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ref<S3BinaryCacheStoreConfig> s3Config;
|
ref<S3BinaryCacheStoreConfig> s3Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abort a multipart upload
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html#API_AbortMultipartUpload_RequestSyntax
|
||||||
|
*/
|
||||||
|
void abortMultipartUpload(std::string_view key, std::string_view uploadId);
|
||||||
};
|
};
|
||||||
|
|
||||||
void S3BinaryCacheStore::upsertFile(
|
void S3BinaryCacheStore::upsertFile(
|
||||||
|
|
@ -37,6 +45,19 @@ void S3BinaryCacheStore::upsertFile(
|
||||||
HttpBinaryCacheStore::upsertFile(path, istream, mimeType, sizeHint);
|
HttpBinaryCacheStore::upsertFile(path, istream, mimeType, sizeHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void S3BinaryCacheStore::abortMultipartUpload(std::string_view key, std::string_view uploadId)
|
||||||
|
{
|
||||||
|
auto req = makeRequest(key);
|
||||||
|
req.setupForS3();
|
||||||
|
|
||||||
|
auto url = req.uri.parsed();
|
||||||
|
url.query["uploadId"] = uploadId;
|
||||||
|
req.uri = VerbatimURL(url);
|
||||||
|
req.method = HttpMethod::DELETE;
|
||||||
|
|
||||||
|
getFileTransfer()->enqueueFileTransfer(req).get();
|
||||||
|
}
|
||||||
|
|
||||||
StringSet S3BinaryCacheStoreConfig::uriSchemes()
|
StringSet S3BinaryCacheStoreConfig::uriSchemes()
|
||||||
{
|
{
|
||||||
return {"s3"};
|
return {"s3"};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue