1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 09:49:36 +01:00

downloadCached: Return ETag

(cherry picked from commit 529add316c)
This commit is contained in:
Eelco Dolstra 2019-02-25 23:20:50 +08:00
parent 94f11d0a61
commit dc29e9fb47
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
6 changed files with 29 additions and 12 deletions

View file

@ -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 };
};