Simplify ContentAddress
Whereas `ContentAddressWithReferences` is a sum type complex because different varieties support different notions of reference, and `ContentAddressMethod` is a nested enum to support that, `ContentAddress` can be a simple pair of a method and hash. `ContentAddress` does not need to be a sum type on the outside because the choice of method doesn't effect what type of hashes we can use. Co-Authored-By: Cale Gibbard <cgibbard@gmail.com>
This commit is contained in:
co-authored by
Cale Gibbard
parent
6db66ebfc5
commit
903700c5e1
@@ -309,10 +309,8 @@ StorePath BinaryCacheStore::addToStoreFromDump(Source & dump, std::string_view n
|
||||
*this,
|
||||
name,
|
||||
FixedOutputInfo {
|
||||
.hash = {
|
||||
.method = method,
|
||||
.hash = nar.first,
|
||||
},
|
||||
.method = method,
|
||||
.hash = nar.first,
|
||||
.references = {
|
||||
.others = references,
|
||||
// caller is not capable of creating a self-reference, because this is content-addressed without modulus
|
||||
@@ -428,10 +426,8 @@ StorePath BinaryCacheStore::addToStore(
|
||||
*this,
|
||||
name,
|
||||
FixedOutputInfo {
|
||||
.hash = {
|
||||
.method = method,
|
||||
.hash = h,
|
||||
},
|
||||
.method = method,
|
||||
.hash = h,
|
||||
.references = {
|
||||
.others = references,
|
||||
// caller is not capable of creating a self-reference, because this is content-addressed without modulus
|
||||
@@ -465,8 +461,8 @@ StorePath BinaryCacheStore::addTextToStore(
|
||||
*this,
|
||||
std::string { name },
|
||||
TextInfo {
|
||||
{ .hash = textHash },
|
||||
references,
|
||||
.hash = textHash,
|
||||
.references = references,
|
||||
},
|
||||
nar.first,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user