diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-02-25 23:20:50 +0800 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-02-25 23:20:50 +0800 |
commit | 529add316c5356a8060c35f987643b7bf5c796dc (patch) | |
tree | 36f4596860f0e55231118c504046010aed268862 /src/libstore/download.hh | |
parent | 6e9182fbc2544e5252366321da1c9406571d01e4 (diff) |
downloadCached: Return ETag
This allows fetchFlake() to return the Git revision of a GitHub
archive.
Diffstat (limited to 'src/libstore/download.hh')
-rw-r--r-- | src/libstore/download.hh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstore/download.hh b/src/libstore/download.hh index f0228f7d0..8acfe4e1a 100644 --- a/src/libstore/download.hh +++ b/src/libstore/download.hh @@ -41,6 +41,12 @@ struct DownloadResult uint64_t bodySize = 0; }; +struct CachedDownloadResult +{ + Path path; + std::optional<std::string> etag; +}; + class Store; struct Downloader @@ -64,8 +70,10 @@ struct Downloader and is more recent than ‘tarball-ttl’ seconds. Otherwise, use the recorded ETag to verify if the server has a more recent version, and if so, download it to the Nix store. */ - Path downloadCached(ref<Store> store, const string & uri, bool unpack, string name = "", - const Hash & expectedHash = Hash(), string * effectiveUri = nullptr, int ttl = settings.tarballTtl); + CachedDownloadResult downloadCached( + ref<Store> store, const string & uri, bool unpack, string name = "", + const Hash & expectedHash = Hash(), string * effectiveUri = nullptr, + int ttl = settings.tarballTtl); enum Error { NotFound, Forbidden, Misc, Transient, Interrupted }; }; |