From da39092a39bbcca80144041b5efc8428cc3b2e4a Mon Sep 17 00:00:00 2001 From: Carlo Nucera Date: Mon, 1 Jun 2020 18:53:31 -0400 Subject: WIP --- src/libstore/file-hash.hh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/libstore/file-hash.hh') 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 #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:’: For paths + computed by makeTextPath() / addTextToStore(). + + * ‘fixed:::’: 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); -- cgit v1.2.3