1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 09:49:36 +01:00
This commit is contained in:
Carlo Nucera 2020-06-01 18:53:31 -04:00
parent 0e9438b6d3
commit da39092a39
5 changed files with 47 additions and 16 deletions

View file

@ -1,5 +1,6 @@
#pragma once
#include <variant>
#include "hash.hh"
namespace nix {
@ -23,6 +24,22 @@ struct FileSystemHash {
std::string printMethodAlgo() const;
};
/*
We've accumulated several types of content-addressed paths over the years;
fixed-output derivations support multiple hash algorithms and serialisation
methods (flat file vs NAR). Thus, ca has one of the following forms:
* text:sha256:<sha256 hash of file contents>: For paths
computed by makeTextPath() / addTextToStore().
* fixed:<r?>:<ht>:<h>: For paths computed by
makeFixedOutputPath() / addToStore().
*/
typedef std::variant<
Hash, // for paths computed by makeTextPath() / addTextToStore
FileSystemHash // for path computed by makeFixedOutputPath
> ContentAddress;
/* Compute the prefix to the hash algorithm which indicates how the files were
ingested. */
std::string makeFileIngestionPrefix(const FileIngestionMethod m);