aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-05-01 18:01:19 +0200
committereldritch horrors <pennae@lix.systems>2024-06-18 23:58:25 +0000
commit0b9a72524af84003de4b19b4eef0027d416e0972 (patch)
tree58258a859445a38df24ecc302611ba82a9074d5c /src/libstore
parentb9b1bbd22fc3b34a4d8e2090f0d033f742c32ee0 (diff)
filetransfer: {up,down}load -> transfer
even the transfer function is not all that necessary since there aren't that many users, but we'll keep it for now. we could've kept both names but we also kind of want to use `download` for something else very soon Change-Id: I005e403ee59de433e139e37aa2045c26a523ccbf
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/filetransfer.cc8
-rw-r--r--src/libstore/filetransfer.hh9
-rw-r--r--src/libstore/http-binary-cache-store.cc4
3 files changed, 5 insertions, 16 deletions
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());
}