aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-07-05 18:53:44 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-07-07 07:30:01 -0400
commit903700c5e168e2ab5bd6bee5e09b5908cb2908d6 (patch)
treea9b92b2a5e04cfae03a02b5d92aaa2719d8d30b8 /src/libfetchers
parent6db66ebfc55769edd0c6bc70fcbd76246d4d26e0 (diff)
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>
Diffstat (limited to 'src/libfetchers')
-rw-r--r--src/libfetchers/fetchers.cc6
-rw-r--r--src/libfetchers/tarball.cc6
2 files changed, 4 insertions, 8 deletions
diff --git a/src/libfetchers/fetchers.cc b/src/libfetchers/fetchers.cc
index 2860c1ceb..f86c0604e 100644
--- a/src/libfetchers/fetchers.cc
+++ b/src/libfetchers/fetchers.cc
@@ -217,10 +217,8 @@ StorePath Input::computeStorePath(Store & store) const
if (!narHash)
throw Error("cannot compute store path for unlocked input '%s'", to_string());
return store.makeFixedOutputPath(getName(), FixedOutputInfo {
- .hash = {
- .method = FileIngestionMethod::Recursive,
- .hash = *narHash,
- },
+ .method = FileIngestionMethod::Recursive,
+ .hash = *narHash,
.references = {},
});
}
diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc
index e42aca6db..a012234e0 100644
--- a/src/libfetchers/tarball.cc
+++ b/src/libfetchers/tarball.cc
@@ -77,10 +77,8 @@ DownloadFileResult downloadFile(
*store,
name,
FixedOutputInfo {
- .hash = {
- .method = FileIngestionMethod::Flat,
- .hash = hash,
- },
+ .method = FileIngestionMethod::Flat,
+ .hash = hash,
.references = {},
},
hashString(htSHA256, sink.s),