1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 23:42:43 +01:00

Merge branch 'drv-outputs-map-allow-missing' of github.com:obsidiansystems/nix into templated-daemon-protocol

This commit is contained in:
John Ericson 2020-08-07 18:51:01 +00:00
commit 8f92bb5ad9
16 changed files with 228 additions and 133 deletions

View file

@ -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)