aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/datatransfer.cc6
-rw-r--r--src/libstore/datatransfer.hh3
-rw-r--r--src/libstore/http-binary-cache-store.cc3
3 files changed, 10 insertions, 2 deletions
diff --git a/src/libstore/datatransfer.cc b/src/libstore/datatransfer.cc
index 9ed06b5c1..dbdf07ad4 100644
--- a/src/libstore/datatransfer.cc
+++ b/src/libstore/datatransfer.cc
@@ -706,6 +706,12 @@ DataTransferResult DataTransfer::download(const DataTransferRequest & request)
return enqueueDataTransfer(request).get();
}
+DataTransferResult DataTransfer::upload(const DataTransferRequest & request)
+{
+ /* Note: this method is the same as download, but helps in readability */
+ return enqueueDataTransfer(request).get();
+}
+
void DataTransfer::download(DataTransferRequest && request, Sink & sink)
{
/* Note: we can't call 'sink' via request.dataCallback, because
diff --git a/src/libstore/datatransfer.hh b/src/libstore/datatransfer.hh
index f2ea53ae3..68d97ceb1 100644
--- a/src/libstore/datatransfer.hh
+++ b/src/libstore/datatransfer.hh
@@ -82,6 +82,9 @@ struct DataTransfer
/* Synchronously download a file. */
DataTransferResult download(const DataTransferRequest & request);
+ /* Synchronously upload a file. */
+ DataTransferResult upload(const DataTransferRequest & request);
+
/* Download a file, writing its data to a sink. The sink will be
invoked on the thread of the caller. */
void download(DataTransferRequest && request, Sink & sink);
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
index 5e446ddf2..c75846bc3 100644
--- a/src/libstore/http-binary-cache-store.cc
+++ b/src/libstore/http-binary-cache-store.cc
@@ -107,7 +107,7 @@ protected:
req.data = std::make_shared<string>(data); // FIXME: inefficient
req.mimeType = mimeType;
try {
- getDataTransfer()->download(req);
+ getDataTransfer()->upload(req);
} catch (DataTransferError & e) {
throw UploadToHTTP("while uploading to HTTP binary cache at '%s': %s", cacheUri, e.msg());
}
@@ -174,4 +174,3 @@ static RegisterStoreImplementation regStore([](
});
}
-