mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Use serializer for std::optional<StorePath>
This commit is contained in:
parent
0503a862ef
commit
a48a737517
1 changed files with 4 additions and 5 deletions
|
|
@ -251,11 +251,10 @@ void WorkerProto::Serialise<ValidPathInfo>::write(
|
||||||
|
|
||||||
UnkeyedValidPathInfo WorkerProto::Serialise<UnkeyedValidPathInfo>::read(const StoreDirConfig & store, ReadConn conn)
|
UnkeyedValidPathInfo WorkerProto::Serialise<UnkeyedValidPathInfo>::read(const StoreDirConfig & store, ReadConn conn)
|
||||||
{
|
{
|
||||||
auto deriver = readString(conn.from);
|
auto deriver = WorkerProto::Serialise<std::optional<StorePath>>::read(store, conn);
|
||||||
auto narHash = Hash::parseAny(readString(conn.from), HashAlgorithm::SHA256);
|
auto narHash = Hash::parseAny(readString(conn.from), HashAlgorithm::SHA256);
|
||||||
UnkeyedValidPathInfo info(narHash);
|
UnkeyedValidPathInfo info(narHash);
|
||||||
if (deriver != "")
|
info.deriver = std::move(deriver);
|
||||||
info.deriver = store.parseStorePath(deriver);
|
|
||||||
info.references = WorkerProto::Serialise<StorePathSet>::read(store, conn);
|
info.references = WorkerProto::Serialise<StorePathSet>::read(store, conn);
|
||||||
conn.from >> info.registrationTime >> info.narSize;
|
conn.from >> info.registrationTime >> info.narSize;
|
||||||
if (GET_PROTOCOL_MINOR(conn.version) >= 16) {
|
if (GET_PROTOCOL_MINOR(conn.version) >= 16) {
|
||||||
|
|
@ -269,8 +268,8 @@ UnkeyedValidPathInfo WorkerProto::Serialise<UnkeyedValidPathInfo>::read(const St
|
||||||
void WorkerProto::Serialise<UnkeyedValidPathInfo>::write(
|
void WorkerProto::Serialise<UnkeyedValidPathInfo>::write(
|
||||||
const StoreDirConfig & store, WriteConn conn, const UnkeyedValidPathInfo & pathInfo)
|
const StoreDirConfig & store, WriteConn conn, const UnkeyedValidPathInfo & pathInfo)
|
||||||
{
|
{
|
||||||
conn.to << (pathInfo.deriver ? store.printStorePath(*pathInfo.deriver) : "")
|
WorkerProto::write(store, conn, pathInfo.deriver);
|
||||||
<< pathInfo.narHash.to_string(HashFormat::Base16, false);
|
conn.to << pathInfo.narHash.to_string(HashFormat::Base16, false);
|
||||||
WorkerProto::write(store, conn, pathInfo.references);
|
WorkerProto::write(store, conn, pathInfo.references);
|
||||||
conn.to << pathInfo.registrationTime << pathInfo.narSize;
|
conn.to << pathInfo.registrationTime << pathInfo.narSize;
|
||||||
if (GET_PROTOCOL_MINOR(conn.version) >= 16) {
|
if (GET_PROTOCOL_MINOR(conn.version) >= 16) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue