enqueueDownload -> enqueueDataTransfer

This commit is contained in:
Nikola Knezevic 2020-04-06 15:37:33 +02:00
parent 142ed7fe45
commit 2df2741ec6
3 changed files with 8 additions and 8 deletions

View file

@ -641,7 +641,7 @@ struct CurlDownloader : public Downloader
}
#endif
void enqueueDownload(const DataTransferRequest & request,
void enqueueDataTransfer(const DataTransferRequest & request,
Callback<DataTransferResult> callback) override
{
/* Ugly hack to support s3:// URIs. */
@ -687,10 +687,10 @@ ref<Downloader> makeDownloader()
return make_ref<CurlDownloader>();
}
std::future<DataTransferResult> Downloader::enqueueDownload(const DataTransferRequest & request)
std::future<DataTransferResult> Downloader::enqueueDataTransfer(const DataTransferRequest & request)
{
auto promise = std::make_shared<std::promise<DataTransferResult>>();
enqueueDownload(request,
enqueueDataTransfer(request,
{[promise](std::future<DataTransferResult> fut) {
try {
promise->set_value(fut.get());
@ -703,7 +703,7 @@ std::future<DataTransferResult> Downloader::enqueueDownload(const DataTransferRe
DataTransferResult Downloader::download(const DataTransferRequest & request)
{
return enqueueDownload(request).get();
return enqueueDataTransfer(request).get();
}
void Downloader::download(DataTransferRequest && request, Sink & sink)
@ -755,7 +755,7 @@ void Downloader::download(DataTransferRequest && request, Sink & sink)
state->avail.notify_one();
};
enqueueDownload(request,
enqueueDataTransfer(request,
{[_state](std::future<DataTransferResult> fut) {
auto state(_state->lock());
state->quit = true;

View file

@ -74,10 +74,10 @@ struct Downloader
/* Enqueue a download request, returning a future to the result of
the download. The future may throw a DownloadError
exception. */
virtual void enqueueDownload(const DataTransferRequest & request,
virtual void enqueueDataTransfer(const DataTransferRequest & request,
Callback<DataTransferResult> callback) = 0;
std::future<DataTransferResult> enqueueDownload(const DataTransferRequest & request);
std::future<DataTransferResult> enqueueDataTransfer(const DataTransferRequest & request);
/* Synchronously download a file. */
DataTransferResult download(const DataTransferRequest & request);

View file

@ -142,7 +142,7 @@ protected:
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
getDownloader()->enqueueDownload(request,
getDownloader()->enqueueDataTransfer(request,
{[callbackPtr, this](std::future<DataTransferResult> result) {
try {
(*callbackPtr)(result.get().data);