aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libfetchers/tarball.cc2
-rw-r--r--src/libstore/filetransfer.cc8
-rw-r--r--src/libstore/filetransfer.hh9
-rw-r--r--src/libstore/http-binary-cache-store.cc4
-rw-r--r--src/nix/upgrade-nix.cc2
5 files changed, 7 insertions, 18 deletions
diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc
index cda6b7acb..c903895e2 100644
--- a/src/libfetchers/tarball.cc
+++ b/src/libfetchers/tarball.cc
@@ -46,7 +46,7 @@ DownloadFileResult downloadFile(
request.expectedETag = getStrAttr(cached->infoAttrs, "etag");
FileTransferResult res;
try {
- res = getFileTransfer()->download(request);
+ res = getFileTransfer()->transfer(request);
} catch (FileTransferError & e) {
if (cached) {
warn("%s; using cached version", e.msg());
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc
index 156ab6f7a..065f38a0c 100644
--- a/src/libstore/filetransfer.cc
+++ b/src/libstore/filetransfer.cc
@@ -817,17 +817,11 @@ ref<FileTransfer> makeFileTransfer()
return makeCurlFileTransfer();
}
-FileTransferResult FileTransfer::download(const FileTransferRequest & request)
+FileTransferResult FileTransfer::transfer(const FileTransferRequest & request)
{
return enqueueFileTransfer(request).get();
}
-FileTransferResult FileTransfer::upload(const FileTransferRequest & request)
-{
- /* Note: this method is the same as download, but helps in readability */
- return enqueueFileTransfer(request).get();
-}
-
template<typename... Args>
FileTransferError::FileTransferError(FileTransfer::Error error, std::optional<std::string> response, const Args & ... args)
: Error(args...), error(error), response(response)
diff --git a/src/libstore/filetransfer.hh b/src/libstore/filetransfer.hh
index 23105e245..5d739112b 100644
--- a/src/libstore/filetransfer.hh
+++ b/src/libstore/filetransfer.hh
@@ -99,14 +99,9 @@ struct FileTransfer
virtual std::future<FileTransferResult> enqueueFileTransfer(const FileTransferRequest & request) = 0;
/**
- * Synchronously download a file.
+ * Synchronously transfer a file.
*/
- FileTransferResult download(const FileTransferRequest & request);
-
- /**
- * Synchronously upload a file.
- */
- FileTransferResult upload(const FileTransferRequest & request);
+ FileTransferResult transfer(const FileTransferRequest & request);
/**
* Download a file, writing its data to a sink. The sink will be
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
index 9fafabe65..8cbb50ee9 100644
--- a/src/libstore/http-binary-cache-store.cc
+++ b/src/libstore/http-binary-cache-store.cc
@@ -115,7 +115,7 @@ protected:
try {
FileTransferRequest request(makeRequest(path));
request.head = true;
- getFileTransfer()->download(request);
+ getFileTransfer()->transfer(request);
return true;
} catch (FileTransferError & e) {
/* S3 buckets return 403 if a file doesn't exist and the
@@ -135,7 +135,7 @@ protected:
req.data = StreamToSourceAdapter(istream).drain();
req.mimeType = mimeType;
try {
- getFileTransfer()->upload(req);
+ getFileTransfer()->transfer(req);
} catch (FileTransferError & e) {
throw UploadToHTTP("while uploading to HTTP binary cache at '%s': %s", cacheUri, e.msg());
}
diff --git a/src/nix/upgrade-nix.cc b/src/nix/upgrade-nix.cc
index cbc28fdd7..c7f31f3fb 100644
--- a/src/nix/upgrade-nix.cc
+++ b/src/nix/upgrade-nix.cc
@@ -286,7 +286,7 @@ struct CmdUpgradeNix : MixDryRun, EvalCommand
// FIXME: use nixos.org?
auto req = FileTransferRequest(storePathsUrl);
- auto res = getFileTransfer()->download(req);
+ auto res = getFileTransfer()->transfer(req);
auto state = std::make_unique<EvalState>(SearchPath{}, store);
auto v = state->allocValue();