diff options
author | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-06-01 18:53:31 -0400 |
---|---|---|
committer | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-06-01 18:53:31 -0400 |
commit | da39092a39bbcca80144041b5efc8428cc3b2e4a (patch) | |
tree | 3816bca4737a6a895d4a921c90f83abfb5d26263 /src/libstore/file-hash.hh | |
parent | 0e9438b6d381a87946ddda8d4bdd06707f9b0a48 (diff) |
WIP
Diffstat (limited to 'src/libstore/file-hash.hh')
-rw-r--r-- | src/libstore/file-hash.hh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libstore/file-hash.hh b/src/libstore/file-hash.hh index 94122db07..9d2b78688 100644 --- a/src/libstore/file-hash.hh +++ b/src/libstore/file-hash.hh @@ -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); |