about summary refs log tree commit diff
path: root/src/libstore/download.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-02-25T15·20+0800
committerEelco Dolstra <edolstra@gmail.com>2019-06-24T19·58+0200
commitdc29e9fb47f9f98a851dc88b2bd3cae4b5c1fe6b (patch)
tree987610c21a2bf0796dc9e2d6b92daca215fd9d6c /src/libstore/download.hh
parent94f11d0a61bba15ff8a93f2de8d1883783c8c508 (diff)
downloadCached: Return ETag
(cherry picked from commit 529add316c5356a8060c35f987643b7bf5c796dc)
Diffstat (limited to 'src/libstore/download.hh')
-rw-r--r--src/libstore/download.hh12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstore/download.hh b/src/libstore/download.hh
index f0228f7d053a..8acfe4e1a39c 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 };
 };