aboutsummaryrefslogtreecommitdiff
path: root/src/nix-daemon
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-09-02 14:33:58 -0400
committerShea Levy <shea@shealevy.com>2016-09-02 14:33:58 -0400
commit584f8a62de117ade154ec8208d939dc194782936 (patch)
treee024b836a9ce4b9fb08e0f29ded2c7a8128de290 /src/nix-daemon
parentecba88de9367f733610121fc0153310f92e05b65 (diff)
Implement nar-based addToStore for remote-store
Diffstat (limited to 'src/nix-daemon')
-rw-r--r--src/nix-daemon/nix-daemon.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 0ef2a6872..d37bcb3e7 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -579,7 +579,30 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
case wopNarFromPath: {
auto path = readStorePath(*store, from);
startWork();
+ stopWork();
dumpPath(path, to);
+ break;
+ }
+
+ case wopAddToStoreNar: {
+ ValidPathInfo info;
+ info.path = readStorePath(*store, from);
+ info.deriver = readString(from);
+ if (!info.deriver.empty())
+ store->assertStorePath(info.deriver);
+ info.narHash = parseHash(htSHA256, readString(from));
+ info.references = readStorePaths<PathSet>(*store, from);
+ info.registrationTime = readInt(from);
+ info.narSize = readLongLong(from);
+ info.ultimate = readLongLong(from);
+ info.sigs = readStrings<StringSet>(from);
+ auto nar = readString(from);
+ auto repair = readInt(from) ? true : false;
+ auto dontCheckSigs = readInt(from) ? true : false;
+ if (!trusted && dontCheckSigs)
+ dontCheckSigs = false;
+ startWork();
+ store->addToStore(info, nar, repair, dontCheckSigs);
stopWork();
break;
}