about summary refs log tree commit diff
path: root/src/nix-daemon
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-03-01T15·07+0100
committerEelco Dolstra <edolstra@gmail.com>2017-03-01T15·07+0100
commitf61f67ddee12a976a0a6a20652e7c545b49fa46c (patch)
treef31e33eaa184861271baa9e10c00e809b70ba3df /src/nix-daemon
parent374908726b87f6cd137ea7d097fdcda57003594e (diff)
RemoteStore::addToStore(): Send NAR rather than string containing NAR
This allows the NAR to be streamed in the future (though we're not
doing that yet).
Diffstat (limited to 'src/nix-daemon')
-rw-r--r--src/nix-daemon/nix-daemon.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index a1b3f2f6fbc3..174821884449 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -283,7 +283,7 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
         }
         HashType hashAlgo = parseHashType(s);
 
-        SavingSourceAdapter savedNAR(from);
+        TeeSource savedNAR(from);
         RetrieveRegularNARSink savedRegular;
 
         if (recursive) {
@@ -297,7 +297,7 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
 
         startWork();
         if (!savedRegular.regular) throw Error("regular file expected");
-        Path path = store->addToStoreFromDump(recursive ? savedNAR.s : savedRegular.s, baseName, recursive, hashAlgo);
+        Path path = store->addToStoreFromDump(recursive ? *savedNAR.data : savedRegular.s, baseName, recursive, hashAlgo);
         stopWork();
 
         to << path;
@@ -569,6 +569,7 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
     }
 
     case wopAddToStoreNar: {
+        bool repair, dontCheckSigs;
         ValidPathInfo info;
         info.path = readStorePath(*store, from);
         from >> info.deriver;
@@ -578,14 +579,16 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
         info.references = readStorePaths<PathSet>(*store, from);
         from >> info.registrationTime >> info.narSize >> info.ultimate;
         info.sigs = readStrings<StringSet>(from);
-        from >> info.ca;
-        auto nar = make_ref<std::string>(readString(from));
-        bool repair, dontCheckSigs;
-        from >> repair >> dontCheckSigs;
+        from >> info.ca >> repair >> dontCheckSigs;
         if (!trusted && dontCheckSigs)
             dontCheckSigs = false;
+
+        TeeSource tee(from);
+        ParseSink sink;
+        parseDump(sink, tee);
+
         startWork();
-        store->addToStore(info, nar, repair, dontCheckSigs, nullptr);
+        store->addToStore(info, tee.data, repair, dontCheckSigs, nullptr);
         stopWork();
         break;
     }