![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include <common-protocol.hh>
Static Public Member Functions | |
| static std::optional< StorePath > | read (const StoreDirConfig &store, CommonProto::ReadConn conn) |
| static void | write (const StoreDirConfig &store, CommonProto::WriteConn conn, const std::optional< StorePath > &str) |
These use the empty string for the null case, relying on the fact that the underlying types never serialize to the empty string.
We do this instead of a generic std::optional<T> instance because ordinal tags (0 or 1, here) are a bit of a compatibility hazard. For the same reason, we don't have a std::variant<T..> instances (ordinal tags 0...n).
We could the generic instances and then these as specializations for compatibility, but that's proven a bit finnicky, and also makes the worker protocol harder to implement in other languages where such specializations may not be allowed.