Skip to content

Commit 4934dbb

Browse files
committed
Remove redundant provenance field from {Read,Write}Conn
This makes `nix copy` from ssh-ng to the daemon preserve provenance, because in combination with the previous commits, RemoteStore::addToStoreMultiple() now sends provenance if the daemon supports it. Fixes #369.
1 parent c23b2fe commit 4934dbb

3 files changed

Lines changed: 2 additions & 6 deletions

File tree

src/libstore/include/nix/store/worker-protocol-connection.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ struct WorkerProto::BasicConnection
3636
return WorkerProto::ReadConn{
3737
.from = from,
3838
.version = protoVersion,
39-
.provenance = protoVersion.features.contains(WorkerProto::featureProvenance),
4039
};
4140
}
4241

@@ -53,7 +52,6 @@ struct WorkerProto::BasicConnection
5352
return WorkerProto::WriteConn{
5453
.to = to,
5554
.version = protoVersion,
56-
.provenance = protoVersion.features.contains(WorkerProto::featureProvenance),
5755
};
5856
}
5957
};

src/libstore/include/nix/store/worker-protocol.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ struct WorkerProto
122122
Source & from;
123123
const Version & version;
124124
bool shortStorePaths = false;
125-
bool provenance = false;
126125
};
127126

128127
/**
@@ -134,7 +133,6 @@ struct WorkerProto
134133
Sink & to;
135134
const Version & version;
136135
bool shortStorePaths = false;
137-
bool provenance = false;
138136
};
139137

140138
/**

src/libstore/worker-protocol.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ UnkeyedValidPathInfo WorkerProto::Serialise<UnkeyedValidPathInfo>::read(const St
353353
info.sigs = WorkerProto::Serialise<std::set<Signature>>::read(store, conn);
354354
info.ca = ContentAddress::parseOpt(readString(conn.from));
355355
}
356-
if (conn.provenance)
356+
if (conn.version.features.contains(WorkerProto::featureProvenance))
357357
info.provenance = Provenance::from_json_str_optional(readString(conn.from));
358358
return info;
359359
}
@@ -370,7 +370,7 @@ void WorkerProto::Serialise<UnkeyedValidPathInfo>::write(
370370
WorkerProto::write(store, conn, pathInfo.sigs);
371371
conn.to << renderContentAddress(pathInfo.ca);
372372
}
373-
if (conn.provenance)
373+
if (conn.version.features.contains(WorkerProto::featureProvenance))
374374
conn.to << (pathInfo.provenance ? pathInfo.provenance->to_json_str() : "");
375375
}
376376

0 commit comments

Comments
 (0)