diff options
Diffstat (limited to 'src/libstore/content-address.hh')
-rw-r--r-- | src/libstore/content-address.hh | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/libstore/content-address.hh b/src/libstore/content-address.hh index c49ab269f..729b1078d 100644 --- a/src/libstore/content-address.hh +++ b/src/libstore/content-address.hh @@ -21,11 +21,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); @@ -37,12 +32,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 @@ -132,4 +139,12 @@ 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 &); + } |