2023-10-20 13:50:21 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
|
2024-07-12 09:37:54 -04:00
|
|
|
#include "hash.hh"
|
|
|
|
#include "path.hh"
|
|
|
|
#include "ref.hh"
|
|
|
|
#include "types.hh"
|
|
|
|
|
2023-10-20 13:50:21 -04:00
|
|
|
namespace nix {
|
|
|
|
class Store;
|
2024-05-03 06:14:01 -04:00
|
|
|
struct SourceAccessor;
|
2023-10-20 13:50:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace nix::fetchers {
|
|
|
|
|
2024-08-12 09:47:02 -04:00
|
|
|
struct Settings;
|
|
|
|
|
2023-10-20 13:50:21 -04:00
|
|
|
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
|
|
|
|
{
|
2024-02-20 06:57:36 -05:00
|
|
|
Hash treeHash;
|
2023-10-20 13:50:21 -04:00
|
|
|
time_t lastModified;
|
|
|
|
std::optional<std::string> immutableUrl;
|
2024-05-03 06:14:01 -04:00
|
|
|
ref<SourceAccessor> accessor;
|
2023-10-20 13:50:21 -04:00
|
|
|
};
|
|
|
|
|
2024-02-20 06:57:36 -05:00
|
|
|
/**
|
|
|
|
* Download and import a tarball into the Git cache. The result is the
|
|
|
|
* Git tree hash of the root directory.
|
|
|
|
*/
|
2024-08-12 09:47:02 -04:00
|
|
|
ref<SourceAccessor> downloadTarball(
|
|
|
|
ref<Store> store,
|
|
|
|
const Settings & settings,
|
|
|
|
const std::string & url);
|
2023-10-20 13:50:21 -04:00
|
|
|
|
|
|
|
}
|