libstore: de-future-ize FileTransfer::enqueueUpload

it's only used once, and synchronously at that.

Change-Id: Ife9db15dd97bc0de8de59a25d27f3f7afeb8791b
This commit is contained in:
eldritch horrors 2024-10-27 18:27:11 +01:00
parent 6f18e1ebde
commit 5cd7055044
3 changed files with 5 additions and 8 deletions

View file

@ -663,10 +663,9 @@ struct curlFileTransfer : public FileTransfer
return enqueueFileTransfer(uri, headers, std::nullopt, false);
}
std::future<FileTransferResult>
enqueueUpload(const std::string & uri, std::string data, const Headers & headers) override
void upload(const std::string & uri, std::string data, const Headers & headers) override
{
return enqueueFileTransfer(uri, headers, std::move(data), false);
enqueueFileTransfer(uri, headers, std::move(data), false).get();
}
std::future<FileTransferResult> enqueueFileTransfer(

View file

@ -80,8 +80,8 @@ struct FileTransfer
/**
* Upload some data. May throw a FileTransferError exception.
*/
virtual std::future<FileTransferResult>
enqueueUpload(const std::string & uri, std::string data, const Headers & headers = {}) = 0;
virtual void
upload(const std::string & uri, std::string data, const Headers & headers = {}) = 0;
/**
* Checks whether the given URI exists. For historical reasons this function

View file

@ -127,9 +127,7 @@ protected:
{
auto data = StreamToSourceAdapter(istream).drain();
try {
getFileTransfer()
->enqueueUpload(makeURI(path), std::move(data), {{"Content-Type", mimeType}})
.get();
getFileTransfer()->upload(makeURI(path), std::move(data), {{"Content-Type", mimeType}});
} catch (FileTransferError & e) {
throw UploadToHTTP(
"while uploading to HTTP binary cache at '%s': %s", cacheUri, e.msg()