mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 17:29:36 +01: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
|
|
@ -4880,8 +4880,17 @@ void Worker::run(const Goals & _topGoals)
|
|||
waitForInput();
|
||||
else {
|
||||
if (awake.empty() && 0 == settings.maxBuildJobs)
|
||||
throw Error("unable to start any build; either increase '--max-jobs' "
|
||||
"or enable remote builds");
|
||||
{
|
||||
if (getMachines().empty())
|
||||
throw Error("unable to start any build; either increase '--max-jobs' "
|
||||
"or enable remote builds."
|
||||
"\nhttps://nixos.org/nix/manual/#chap-distributed-builds");
|
||||
else
|
||||
throw Error("unable to start any build; remote machines may not have "
|
||||
"all required system features."
|
||||
"\nhttps://nixos.org/nix/manual/#chap-distributed-builds");
|
||||
|
||||
}
|
||||
assert(!awake.empty());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ void WorkerProto<std::string>::write(const Store & store, Sink & out, const std:
|
|||
out << str;
|
||||
}
|
||||
|
||||
|
||||
StorePath WorkerProto<StorePath>::read(const Store & store, Source & from)
|
||||
{
|
||||
return store.parseStorePath(readString(from));
|
||||
|
|
@ -42,6 +43,7 @@ void WorkerProto<StorePath>::write(const Store & store, Sink & out, const StoreP
|
|||
out << store.printStorePath(storePath);
|
||||
}
|
||||
|
||||
|
||||
ContentAddress WorkerProto<ContentAddress>::read(const Store & store, Source & from)
|
||||
{
|
||||
return parseContentAddress(readString(from));
|
||||
|
|
@ -53,6 +55,29 @@ void WorkerProto<ContentAddress>::write(const Store & store, Sink & out, const C
|
|||
}
|
||||
|
||||
|
||||
std::optional<StorePath> WorkerProto<std::optional<StorePath>>::read(const Store & store, Source & from)
|
||||
{
|
||||
auto s = readString(from);
|
||||
return s == "" ? std::optional<StorePath> {} : store.parseStorePath(s);
|
||||
}
|
||||
|
||||
void WorkerProto<std::optional<StorePath>>::write(const Store & store, Sink & out, const std::optional<StorePath> & storePathOpt)
|
||||
{
|
||||
out << (storePathOpt ? store.printStorePath(*storePathOpt) : "");
|
||||
}
|
||||
|
||||
|
||||
std::optional<ContentAddress> WorkerProto<std::optional<ContentAddress>>::read(const Store & store, Source & from)
|
||||
{
|
||||
return parseContentAddressOpt(readString(from));
|
||||
}
|
||||
|
||||
void WorkerProto<std::optional<ContentAddress>>::write(const Store & store, Sink & out, const std::optional<ContentAddress> & caOpt)
|
||||
{
|
||||
out << (caOpt ? renderContentAddress(*caOpt) : "");
|
||||
}
|
||||
|
||||
|
||||
/* TODO: Separate these store impls into different files, give them better names */
|
||||
RemoteStore::RemoteStore(const Params & params)
|
||||
: Store(params)
|
||||
|
|
|
|||
|
|
@ -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