mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
downloadCached: Return ETag
This allows fetchFlake() to return the Git revision of a GitHub archive.
This commit is contained in:
parent
6e9182fbc2
commit
529add316c
7 changed files with 64 additions and 26 deletions
|
@ -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 };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue