forked from lix-project/lix
libstore: de-future-ize FileTransfer::enqueueUpload
it's only used once, and synchronously at that.
Change-Id: Ife9db15dd97bc0de8de59a25d27f3f7afeb8791b
This commit is contained in:
parent
6f18e1ebde
commit
5cd7055044
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue