diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-07 12:37:33 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-07 12:37:33 +0100 |
commit | 8a268359b06471b463a8f3fc46c83a1fced8ab75 (patch) | |
tree | b9a854b5faf432d158a449ec3f14146e4e6db00d /src/libstore/legacy-ssh-store.cc | |
parent | 9eb58f5209f9cd1fd18f33b691c6a613075dffc4 (diff) |
Merge pull request #9560 from obsidiansystems/serve-proto-unkeyed-valid-path-info-serializer
Factor out `ServeProto::Serialiser<UnkeyedValidPathInfo>` and test
(cherry picked from commit 139982997eec493a0f74105c427953f6be77da6d)
Change-Id: I28e4ba5a681a90d81915a56e6dbaa5456d64f96d
Diffstat (limited to 'src/libstore/legacy-ssh-store.cc')
-rw-r--r-- | src/libstore/legacy-ssh-store.cc | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc index 7e119ce49..890c8a149 100644 --- a/src/libstore/legacy-ssh-store.cc +++ b/src/libstore/legacy-ssh-store.cc @@ -172,24 +172,12 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor if (p.empty()) return callback(nullptr); auto path2 = parseStorePath(p); assert(path == path2); - /* Hash will be set below. FIXME construct ValidPathInfo at end. */ - auto info = std::make_shared<ValidPathInfo>(path, Hash::dummy); - - auto deriver = readString(conn->from); - if (deriver != "") - info->deriver = parseStorePath(deriver); - info->references = ServeProto::Serialise<StorePathSet>::read(*this, *conn); - readLongLong(conn->from); // download size - info->narSize = readLongLong(conn->from); - - { - auto s = readString(conn->from); - if (s == "") - throw Error("NAR hash is now mandatory"); - info->narHash = Hash::parseAnyPrefixed(s); - } - info->ca = ContentAddress::parseOpt(readString(conn->from)); - info->sigs = readStrings<StringSet>(conn->from); + auto info = std::make_shared<ValidPathInfo>( + path, + ServeProto::Serialise<UnkeyedValidPathInfo>::read(*this, *conn)); + + if (info->narHash == Hash::dummy) + throw Error("NAR hash is now mandatory"); auto s = readString(conn->from); assert(s == ""); |