2016-02-16 17:38:44 +02:00
|
|
|
#pragma once
|
2023-04-01 06:18:41 +03:00
|
|
|
///@file
|
2016-02-16 17:38:44 +02:00
|
|
|
|
|
|
|
#include "types.hh"
|
|
|
|
#include "hash.hh"
|
2020-08-06 21:31:48 +03:00
|
|
|
#include "path-info.hh"
|
2016-02-16 17:38:44 +02:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2020-08-06 21:31:48 +03:00
|
|
|
class Store;
|
|
|
|
|
2016-02-16 17:38:44 +02:00
|
|
|
struct NarInfo : ValidPathInfo
|
|
|
|
{
|
|
|
|
std::string url;
|
|
|
|
std::string compression;
|
2020-06-19 23:50:28 +03:00
|
|
|
std::optional<Hash> fileHash;
|
2016-02-16 17:38:44 +02:00
|
|
|
uint64_t fileSize = 0;
|
|
|
|
|
2019-12-05 20:11:09 +02:00
|
|
|
NarInfo() = delete;
|
2023-01-23 19:58:11 +02:00
|
|
|
NarInfo(const Store & store, std::string && name, ContentAddressWithReferences && ca, Hash narHash)
|
|
|
|
: ValidPathInfo(store, std::move(name), std::move(ca), narHash)
|
2020-10-07 16:52:20 +03:00
|
|
|
{ }
|
2020-08-06 21:31:48 +03:00
|
|
|
NarInfo(StorePath && path, Hash narHash) : ValidPathInfo(std::move(path), narHash) { }
|
2016-02-16 17:38:44 +02:00
|
|
|
NarInfo(const ValidPathInfo & info) : ValidPathInfo(info) { }
|
2016-06-01 15:49:12 +03:00
|
|
|
NarInfo(const Store & store, const std::string & s, const std::string & whence);
|
2016-02-16 17:38:44 +02:00
|
|
|
|
2023-10-27 02:39:21 +03:00
|
|
|
DECLARE_CMP(NarInfo);
|
|
|
|
|
2019-12-05 20:11:09 +02:00
|
|
|
std::string to_string(const Store & store) const;
|
2023-10-23 04:12:54 +03:00
|
|
|
|
|
|
|
nlohmann::json toJSON(
|
|
|
|
const Store & store,
|
|
|
|
bool includeImpureInfo,
|
|
|
|
HashFormat hashFormat) const override;
|
|
|
|
static NarInfo fromJSON(
|
|
|
|
const Store & store,
|
|
|
|
const StorePath & path,
|
|
|
|
const nlohmann::json & json);
|
2016-02-16 17:38:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|