aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/content-address.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-04-19 14:13:30 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-04-19 14:13:30 -0400
commitaba8a8a83a89d577769a39a69e9b90e3ed0d4f82 (patch)
treea0bbf8ca8067c000ca2d2acdd367ffefad1f78cd /src/libstore/content-address.hh
parent20decfd30261bd46d2bf78209cb2bdd144fcd0b4 (diff)
Add a few more content addressing methods
Good to round out the library interface.
Diffstat (limited to 'src/libstore/content-address.hh')
-rw-r--r--src/libstore/content-address.hh23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/libstore/content-address.hh b/src/libstore/content-address.hh
index 8668acacf..eb01e9ce4 100644
--- a/src/libstore/content-address.hh
+++ b/src/libstore/content-address.hh
@@ -154,8 +154,9 @@ struct ContentAddress
{ }
/**
- * Compute the content-addressability assertion (ValidPathInfo::ca) for
- * paths created by Store::makeFixedOutputPath() / Store::addToStore().
+ * Compute the content-addressability assertion
+ * (`ValidPathInfo::ca`) for paths created by
+ * `Store::makeFixedOutputPath()` / `Store::addToStore()`.
*/
std::string render() const;
@@ -163,6 +164,18 @@ struct ContentAddress
static std::optional<ContentAddress> parseOpt(std::string_view rawCaOpt);
+ /**
+ * Create a `ContentAddress` from 2 parts:
+ *
+ * @param method Way ingesting the file system data.
+ *
+ * @param hash Hash of ingested file system data.
+ */
+ static ContentAddress fromParts(
+ ContentAddressMethod method, Hash hash);
+
+ ContentAddressMethod getMethod() const;
+
const Hash & getHash() const;
};
@@ -251,13 +264,13 @@ struct ContentAddressWithReferences
{ }
/**
- * Create a ContentAddressWithReferences from a mere ContentAddress, by
- * assuming no references in all cases.
+ * Create a `ContentAddressWithReferences` from a mere
+ * `ContentAddress`, by assuming no references in all cases.
*/
static ContentAddressWithReferences withoutRefs(const ContentAddress &);
/**
- * Create a ContentAddressWithReferences from 3 parts:
+ * Create a `ContentAddressWithReferences` from 3 parts:
*
* @param method Way ingesting the file system data.
*