diff options
author | Robert Hensing <robert@roberthensing.nl> | 2020-09-17 17:15:05 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2020-09-17 20:21:04 +0200 |
commit | dfa547c6a81d6fb7ef3d3f69a98ebe969df42828 (patch) | |
tree | fd97a53ce56825686d725e9f8743198bb1738ef3 /src/libstore/content-address.hh | |
parent | 29c82ccc77714a74e8948ce8c531de5a8d870176 (diff) |
Add ContentAddressMethod and parse/render it
Diffstat (limited to 'src/libstore/content-address.hh')
-rw-r--r-- | src/libstore/content-address.hh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libstore/content-address.hh b/src/libstore/content-address.hh index 22a039242..f6a6f5140 100644 --- a/src/libstore/content-address.hh +++ b/src/libstore/content-address.hh @@ -55,4 +55,23 @@ 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); + } |