diff options
author | eldritch horrors <pennae@lix.systems> | 2024-05-09 21:22:48 +0200 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-06-19 10:50:12 +0000 |
commit | c55dcc6c13b864dc613a0a6ba51e0b897868f4b4 (patch) | |
tree | 2c588cf6dd0662b9b8875e9dd7802b564e9306c5 /src/libstore/filetransfer.hh | |
parent | 11f4a5bc7eca8a4cca2ae9f3d83b69cd497933f8 (diff) |
filetransfer: return a Source from download()
without this we will not be able to get rid of makeDecompressionSink,
which in turn will be necessary to get rid of sourceToSink (since the
libarchive archive wrapper *must* be a Source due to api limitations)
Change-Id: Iccd3d333ba2cbcab49cb5a1d3125624de16bce27
Diffstat (limited to 'src/libstore/filetransfer.hh')
-rw-r--r-- | src/libstore/filetransfer.hh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libstore/filetransfer.hh b/src/libstore/filetransfer.hh index 5d739112b..b2ee66312 100644 --- a/src/libstore/filetransfer.hh +++ b/src/libstore/filetransfer.hh @@ -1,6 +1,7 @@ #pragma once ///@file +#include "box_ptr.hh" #include "logging.hh" #include "serialise.hh" #include "types.hh" @@ -104,10 +105,13 @@ struct FileTransfer FileTransferResult transfer(const FileTransferRequest & request); /** - * Download a file, writing its data to a sink. The sink will be - * invoked on the thread of the caller. + * Download a file, returning its contents through a source. Will not return + * before the transfer has fully started, ensuring that any errors thrown by + * the setup phase (e.g. HTTP 404 or similar errors) are not postponed to be + * thrown by the returned source. The source will only throw errors detected + * during the transfer itself (decompression errors, connection drops, etc). */ - virtual void download(FileTransferRequest && request, Sink & sink) = 0; + virtual box_ptr<Source> download(FileTransferRequest && request) = 0; enum Error { NotFound, Forbidden, Misc, Transient, Interrupted }; }; |