1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 09:11:47 +02:00

Move ValidPathInfo serialization code to worker-protocol.{cc.hh}

It does not belong with the data type itself.

This also materializes the fact that `copyPath` does not do any version
negotiation just just hard-codes "16".

The non-standard interface of these serializers makes it harder to test,
but this is fixed in the next commit which then adds those tests.
This commit is contained in:
John Ericson 2022-03-08 23:09:26 +00:00
parent ab822af0df
commit 596bd469cc
7 changed files with 76 additions and 66 deletions

View file

@ -31,6 +31,7 @@ struct Source;
struct DerivedPath;
struct BuildResult;
struct KeyedBuildResult;
struct ValidPathInfo;
enum TrustedFlag : bool;
@ -220,4 +221,15 @@ template<typename K, typename V>
DECLARE_WORKER_SERIALISER(std::map<K COMMA_ V>);
#undef COMMA_
/* These are a non-standard form for historical reasons. */
template<>
struct WorkerProto::Serialise<ValidPathInfo>
{
static ValidPathInfo read(const Store & store, WorkerProto::ReadConn conn);
static ValidPathInfo read(const Store & store, WorkerProto::ReadConn conn, StorePath && path);
static void write(const Store & store, WriteConn conn, const ValidPathInfo & pathInfo, bool includePath = true);
};
}