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.hh53
1 files changed, 29 insertions, 24 deletions
diff --git a/src/libstore/content-address.hh b/src/libstore/content-address.hh
index e15d76bd7..126244ab5 100644
--- a/src/libstore/content-address.hh
+++ b/src/libstore/content-address.hh
@@ -7,7 +7,7 @@
namespace nix {
/*
- * Mini content address
+ * Content addressing method
*/
enum struct FileIngestionMethod : uint8_t {
@@ -15,6 +15,34 @@ enum struct FileIngestionMethod : uint8_t {
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;
+};
+
+/* Compute the prefix to the hash algorithm which indicates how the files were
+ ingested. */
+std::string makeFileIngestionPrefix(const FileIngestionMethod m);
+
+
+typedef std::variant<
+ TextHashMethod,
+ FixedOutputHashMethod
+ > ContentAddressMethod;
+
+ContentAddressMethod parseContentAddressMethod(std::string_view rawCaMethod);
+
+std::string renderContentAddressMethod(ContentAddressMethod caMethod);
+
+/*
+ * Mini content address
+ */
struct TextHash {
Hash hash;
@@ -43,10 +71,6 @@ typedef std::variant<
FixedOutputHash // 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);
-
std::string renderContentAddress(ContentAddress ca);
std::string renderContentAddress(std::optional<ContentAddress> ca);
@@ -58,25 +82,6 @@ std::optional<ContentAddress> parseContentAddressOpt(std::string_view rawCaOpt);
Hash getContentAddressHash(const ContentAddress & ca);
/*
- 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;
-};
-
-typedef std::variant<
- TextHashMethod,
- FixedOutputHashMethod
- > ContentAddressMethod;
-
-ContentAddressMethod parseContentAddressMethod(std::string_view rawCaMethod);
-
-std::string renderContentAddressMethod(ContentAddressMethod caMethod);
-
-/*
* References set
*/