mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 07:46:21 +02:00
Extend the worker protocol with wopAddPermRoot
This commit is contained in:
parent
9796ebd7ef
commit
226b0f3956
2 changed files with 17 additions and 1 deletions
|
@ -657,6 +657,21 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WorkerProto::Op::AddPermRoot: {
|
||||||
|
if (!trusted)
|
||||||
|
throw Error(
|
||||||
|
"you are not privileged to create perm roots\n\n"
|
||||||
|
"hint: you can just do this client-side without special privileges, and probably want to do that instead.");
|
||||||
|
auto storePath = WorkerProto::Serialise<StorePath>::read(*store, rconn);
|
||||||
|
Path gcRoot = absPath(readString(from));
|
||||||
|
logger->startWork();
|
||||||
|
auto & localFSStore = require<LocalFSStore>(*store);
|
||||||
|
localFSStore.addPermRoot(storePath, gcRoot);
|
||||||
|
logger->stopWork();
|
||||||
|
to << gcRoot;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WorkerProto::Op::AddIndirectRoot: {
|
case WorkerProto::Op::AddIndirectRoot: {
|
||||||
Path path = absPath(readString(from));
|
Path path = absPath(readString(from));
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace nix {
|
||||||
#define WORKER_MAGIC_1 0x6e697863
|
#define WORKER_MAGIC_1 0x6e697863
|
||||||
#define WORKER_MAGIC_2 0x6478696f
|
#define WORKER_MAGIC_2 0x6478696f
|
||||||
|
|
||||||
#define PROTOCOL_VERSION (1 << 8 | 35)
|
#define PROTOCOL_VERSION (1 << 8 | 36)
|
||||||
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
|
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
|
||||||
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
|
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
|
||||||
|
|
||||||
|
@ -161,6 +161,7 @@ enum struct WorkerProto::Op : uint64_t
|
||||||
AddMultipleToStore = 44,
|
AddMultipleToStore = 44,
|
||||||
AddBuildLog = 45,
|
AddBuildLog = 45,
|
||||||
BuildPathsWithResults = 46,
|
BuildPathsWithResults = 46,
|
||||||
|
AddPermRoot = 47,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue