mirror of
https://github.com/NixOS/nix.git
synced 2025-11-25 03:39:36 +01:00
Add a few more content addressing methods
Good to round out the library interface.
This commit is contained in:
parent
20decfd302
commit
aba8a8a83a
2 changed files with 67 additions and 24 deletions
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue