mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 10:46:15 +02:00
d29786f258
This was used in only one place, namely builtins.fetchurl with an expected hash. Since this can cause similar issues as described in #9814 and #9905 with the "locked" flag for fetchTarball and fetchTree, let's just remove it. Note that if an expected hash is given and the hash algorithm is SHA-256, then we will never do a download anyway if the resulting store path already exists. So removing the "locked" flag will only cause potentially unnecessary HTTP requests (subject to the tarball TTL) for non-SHA-256 hashes.
46 lines
861 B
C++
46 lines
861 B
C++
#pragma once
|
|
|
|
#include "types.hh"
|
|
#include "path.hh"
|
|
#include "hash.hh"
|
|
|
|
#include <optional>
|
|
|
|
namespace nix {
|
|
class Store;
|
|
struct InputAccessor;
|
|
}
|
|
|
|
namespace nix::fetchers {
|
|
|
|
struct DownloadFileResult
|
|
{
|
|
StorePath storePath;
|
|
std::string etag;
|
|
std::string effectiveUrl;
|
|
std::optional<std::string> immutableUrl;
|
|
};
|
|
|
|
DownloadFileResult downloadFile(
|
|
ref<Store> store,
|
|
const std::string & url,
|
|
const std::string & name,
|
|
const Headers & headers = {});
|
|
|
|
struct DownloadTarballResult
|
|
{
|
|
Hash treeHash;
|
|
time_t lastModified;
|
|
std::optional<std::string> immutableUrl;
|
|
ref<InputAccessor> accessor;
|
|
};
|
|
|
|
/**
|
|
* Download and import a tarball into the Git cache. The result is the
|
|
* Git tree hash of the root directory.
|
|
*/
|
|
DownloadTarballResult downloadTarball(
|
|
const std::string & url,
|
|
const Headers & headers = {});
|
|
|
|
}
|