mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Restore ServeProto::Command::ImportPaths
This partially reverts commit5e46df973f, partially reversing changes made to8c789db05b. We do this because Hydra, while using the newer version of the protocol, still uses this command, even though Nix (as a client) doesn't use it. On that basis, we don't want to remove it (or consider it only part of the older versions of the protocol) until Hydra no longer uses the Legacy SSH Protocol. (cherry picked from commit0deb492b3d)
This commit is contained in:
parent
cf6ad228ae
commit
a038c92d38
4 changed files with 29 additions and 0 deletions
|
|
@ -82,6 +82,8 @@ struct ServeProto::BasicClientConnection
|
|||
BuildResult getBuildDerivationResponse(const StoreDirConfig & store);
|
||||
|
||||
void narFromPath(const StoreDirConfig & store, const StorePath & path, std::function<void(Source &)> fun);
|
||||
|
||||
void importPaths(const StoreDirConfig & store, std::function<void(Sink &)> fun);
|
||||
};
|
||||
|
||||
struct ServeProto::BasicServerConnection
|
||||
|
|
|
|||
|
|
@ -108,6 +108,13 @@ enum struct ServeProto::Command : uint64_t {
|
|||
QueryValidPaths = 1,
|
||||
QueryPathInfos = 2,
|
||||
DumpStorePath = 3,
|
||||
/**
|
||||
* @note This is no longer used by Nix (as a client), but it is used
|
||||
* by Hydra. We should therefore not remove it until Hydra no longer
|
||||
* uses it either.
|
||||
*/
|
||||
ImportPaths = 4,
|
||||
// ExportPaths = 5,
|
||||
BuildPaths = 6,
|
||||
QueryClosure = 7,
|
||||
BuildDerivation = 8,
|
||||
|
|
|
|||
|
|
@ -93,4 +93,14 @@ void ServeProto::BasicClientConnection::narFromPath(
|
|||
fun(from);
|
||||
}
|
||||
|
||||
void ServeProto::BasicClientConnection::importPaths(const StoreDirConfig & store, std::function<void(Sink &)> fun)
|
||||
{
|
||||
to << ServeProto::Command::ImportPaths;
|
||||
fun(to);
|
||||
to.flush();
|
||||
|
||||
if (readInt(from) != 1)
|
||||
throw Error("remote machine failed to import closure");
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -986,6 +986,16 @@ static void opServe(Strings opFlags, Strings opArgs)
|
|||
store->narFromPath(store->parseStorePath(readString(in)), out);
|
||||
break;
|
||||
|
||||
case ServeProto::Command::ImportPaths: {
|
||||
if (!writeAllowed)
|
||||
throw Error("importing paths is not allowed");
|
||||
// FIXME: should we skip sig checking?
|
||||
importPaths(*store, in, NoCheckSigs);
|
||||
// indicate success
|
||||
out << 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case ServeProto::Command::BuildPaths: {
|
||||
|
||||
if (!writeAllowed)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue