mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Add an HTTP binary cache store
Allowing stuff like NIX_REMOTE=https://cache.nixos.org nix-store -qR /nix/store/x1p1gl3a4kkz5ci0nfbayjqlqmczp1kq-geeqie-1.1 or NIX_REMOTE=https://cache.nixos.org nix-store --export /nix/store/x1p1gl3a4kkz5ci0nfbayjqlqmczp1kq-geeqie-1.1 | nix-store --import
This commit is contained in:
parent
6170bb474b
commit
e9c50064b5
7 changed files with 102 additions and 61 deletions
|
@ -10,7 +10,8 @@ struct DownloadOptions
|
|||
{
|
||||
string expectedETag;
|
||||
bool verifyTLS{true};
|
||||
bool forceProgress{false};
|
||||
enum { yes, no, automatic } showProgress{yes};
|
||||
bool head{false};
|
||||
};
|
||||
|
||||
struct DownloadResult
|
||||
|
@ -21,11 +22,25 @@ struct DownloadResult
|
|||
|
||||
class Store;
|
||||
|
||||
DownloadResult downloadFile(string url, const DownloadOptions & options);
|
||||
struct Downloader
|
||||
{
|
||||
virtual DownloadResult download(string url, const DownloadOptions & options) = 0;
|
||||
|
||||
Path downloadFileCached(ref<Store> store, const string & url, bool unpack);
|
||||
Path downloadCached(ref<Store> store, const string & url, bool unpack);
|
||||
|
||||
MakeError(DownloadError, Error)
|
||||
enum Error { NotFound, Forbidden, Misc };
|
||||
};
|
||||
|
||||
ref<Downloader> makeDownloader();
|
||||
|
||||
class DownloadError : public Error
|
||||
{
|
||||
public:
|
||||
Downloader::Error error;
|
||||
DownloadError(Downloader::Error error, const FormatOrString & fs)
|
||||
: Error(fs), error(error)
|
||||
{ }
|
||||
};
|
||||
|
||||
bool isUri(const string & s);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue