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.hh31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/libstore/content-address.hh b/src/libstore/content-address.hh
index f8a4d5370..c07fe0a88 100644
--- a/src/libstore/content-address.hh
+++ b/src/libstore/content-address.hh
@@ -22,11 +22,6 @@ enum struct FileIngestionMethod : uint8_t {
Recursive = true
};
-struct FixedOutputHashMethod {
- FileIngestionMethod fileIngestionMethod;
- HashType hashType;
-};
-
/* Compute the prefix to the hash algorithm which indicates how the files were
ingested. */
std::string makeFileIngestionPrefix(FileIngestionMethod m);
@@ -38,12 +33,24 @@ std::string makeFileIngestionPrefix(FileIngestionMethod m);
further below. */
typedef std::variant<
TextHashMethod,
- FixedOutputHashMethod
+ FileIngestionMethod
> ContentAddressMethod;
-ContentAddressMethod parseContentAddressMethod(std::string_view rawCaMethod);
+/* Parse and pretty print the algorithm which indicates how the files
+ were ingested, with the the fixed output case not prefixed for back
+ compat. */
+
+std::string makeContentAddressingPrefix(ContentAddressMethod m);
+
+ContentAddressMethod parseContentAddressingPrefix(std::string_view & m);
+
+/* Parse and pretty print a content addressing method and hash in a
+ nicer way, prefixing both cases. */
+
+std::string renderContentAddressMethodAndHash(ContentAddressMethod cam, HashType ht);
+
+std::pair<ContentAddressMethod, HashType> parseContentAddressMethod(std::string_view caMethod);
-std::string renderContentAddressMethod(ContentAddressMethod caMethod);
/*
* Mini content address
@@ -125,6 +132,14 @@ typedef std::variant<
ContentAddressWithReferences caWithoutRefs(const ContentAddress &);
+ContentAddressWithReferences contentAddressFromMethodHashAndRefs(
+ ContentAddressMethod method, Hash && hash, StoreReferences && refs);
+
+ContentAddressMethod getContentAddressMethod(const ContentAddressWithReferences & ca);
+Hash getContentAddressHash(const ContentAddressWithReferences & ca);
+
+std::string printMethodAlgo(const ContentAddressWithReferences &);
+
struct StorePathDescriptor {
std::string name;
ContentAddressWithReferences info;