aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/content-address.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/content-address.hh')
-rw-r--r--src/libstore/content-address.hh18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/libstore/content-address.hh b/src/libstore/content-address.hh
index acdb4f023..a275800f9 100644
--- a/src/libstore/content-address.hh
+++ b/src/libstore/content-address.hh
@@ -11,17 +11,16 @@ namespace nix {
* Content addressing method
*/
+/* We only have one way to hash text with references, so this is a single-value
+ type, mainly useful with std::variant.
+*/
+struct TextHashMethod : std::monostate { };
+
enum struct FileIngestionMethod : uint8_t {
Flat = false,
Recursive = true
};
-/*
- We only have one way to hash text with references, so this is single-value
- type is only useful in std::variant.
-*/
-struct TextHashMethod { };
-
struct FixedOutputHashMethod {
FileIngestionMethod fileIngestionMethod;
HashType hashType;
@@ -29,9 +28,13 @@ struct FixedOutputHashMethod {
/* Compute the prefix to the hash algorithm which indicates how the files were
ingested. */
-std::string makeFileIngestionPrefix(const FileIngestionMethod m);
+std::string makeFileIngestionPrefix(FileIngestionMethod m);
+/* Just the type of a content address. Combine with the hash itself, and we
+ have a `ContentAddress` as defined below. Combine that, in turn, with info
+ on references, and we have `ContentAddressWithReferences`, as defined
+ further below. */
typedef std::variant<
TextHashMethod,
FixedOutputHashMethod
@@ -86,6 +89,7 @@ std::optional<ContentAddress> parseContentAddressOpt(std::string_view rawCaOpt);
Hash getContentAddressHash(const ContentAddress & ca);
+
/*
* References set
*/