1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 01:11:15 +02:00

Restrict some code to StoreDirConfig

- part of eval cache
 - part of derivations
 - derived path
 - store path with outputs
 - serializers
This commit is contained in:
John Ericson 2022-03-18 15:35:45 +00:00
parent e97ac09abe
commit dde1d86338
30 changed files with 175 additions and 157 deletions

View file

@ -16,11 +16,11 @@ namespace nix {
/* protocol-agnostic templates */
#define WORKER_USE_LENGTH_PREFIX_SERIALISER(TEMPLATE, T) \
TEMPLATE T WorkerProto::Serialise< T >::read(const Store & store, WorkerProto::ReadConn conn) \
TEMPLATE T WorkerProto::Serialise< T >::read(const StoreDirConfig & store, WorkerProto::ReadConn conn) \
{ \
return LengthPrefixedProtoHelper<WorkerProto, T >::read(store, conn); \
} \
TEMPLATE void WorkerProto::Serialise< T >::write(const Store & store, WorkerProto::WriteConn conn, const T & t) \
TEMPLATE void WorkerProto::Serialise< T >::write(const StoreDirConfig & store, WorkerProto::WriteConn conn, const T & t) \
{ \
LengthPrefixedProtoHelper<WorkerProto, T >::write(store, conn, t); \
}
@ -41,12 +41,12 @@ WORKER_USE_LENGTH_PREFIX_SERIALISER(
template<typename T>
struct WorkerProto::Serialise
{
static T read(const Store & store, WorkerProto::ReadConn conn)
static T read(const StoreDirConfig & store, WorkerProto::ReadConn conn)
{
return CommonProto::Serialise<T>::read(store,
CommonProto::ReadConn { .from = conn.from });
}
static void write(const Store & store, WorkerProto::WriteConn conn, const T & t)
static void write(const StoreDirConfig & store, WorkerProto::WriteConn conn, const T & t)
{
CommonProto::Serialise<T>::write(store,
CommonProto::WriteConn { .to = conn.to },