mirror of
https://github.com/NixOS/nix
synced 2025-06-30 15:48:00 +02:00
Merge branch 'drv-outputs-map-allow-missing' of github.com:obsidiansystems/nix into templated-daemon-protocol
This commit is contained in:
commit
8f92bb5ad9
16 changed files with 228 additions and 133 deletions
|
@ -72,23 +72,16 @@ struct WorkerProto {
|
|||
static void write(const Store & store, Sink & out, const T & t);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct WorkerProto<std::string> {
|
||||
static std::string read(const Store & store, Source & from);
|
||||
static void write(const Store & store, Sink & out, const std::string & t);
|
||||
};
|
||||
#define MAKE_WORKER_PROTO(T) \
|
||||
template<> \
|
||||
struct WorkerProto< T > { \
|
||||
static T read(const Store & store, Source & from); \
|
||||
static void write(const Store & store, Sink & out, const T & t); \
|
||||
}
|
||||
|
||||
template<>
|
||||
struct WorkerProto<StorePath> {
|
||||
static StorePath read(const Store & store, Source & from);
|
||||
static void write(const Store & store, Sink & out, const StorePath & t);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct WorkerProto<ContentAddress> {
|
||||
static ContentAddress read(const Store & store, Source & from);
|
||||
static void write(const Store & store, Sink & out, const ContentAddress & t);
|
||||
};
|
||||
MAKE_WORKER_PROTO(std::string);
|
||||
MAKE_WORKER_PROTO(StorePath);
|
||||
MAKE_WORKER_PROTO(ContentAddress);
|
||||
|
||||
template<typename T>
|
||||
struct WorkerProto<std::set<T>> {
|
||||
|
@ -164,4 +157,13 @@ struct WorkerProto<std::optional<T>> {
|
|||
|
||||
};
|
||||
|
||||
/* Specialization which uses and empty string for the empty case, taking
|
||||
advantage of the fact these types always serialize to non-empty strings.
|
||||
This is done primarily for backwards compatability, so that T <=
|
||||
std::optional<T>, where <= is the compatability partial order, T is one of
|
||||
the types below.
|
||||
*/
|
||||
MAKE_WORKER_PROTO(std::optional<StorePath>);
|
||||
MAKE_WORKER_PROTO(std::optional<ContentAddress>);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue