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