about summary refs log tree commit diff
path: root/src/nix-store/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-06-21T07·38+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-06-21T07·38+0000
commitdaf0a923c7c77300dfb09ee34c1ae31c87002a0e (patch)
treed72b2533082046b3f02a8e8d2a54423af823c8cf /src/nix-store/main.cc
parent15c60ca1b64a4e5dc874f60c764f0ccc8899d740 (diff)
* Wrap calls to registerSubstitute() in a single transaction to
  improve throughput.
* Don't build the `substitute-rev' table for now, since it caused
  Theta(N^2) time and log file consumption when adding N substitutes.
  Maybe we can do without it.

Diffstat (limited to 'src/nix-store/main.cc')
-rw-r--r--src/nix-store/main.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc
index 79d65c4be5d5..4df736911cae 100644
--- a/src/nix-store/main.cc
+++ b/src/nix-store/main.cc
@@ -170,6 +170,9 @@ static void opSubstitute(Strings opFlags, Strings opArgs)
     if (!opArgs.empty())
         throw UsageError("no arguments expected");
 
+    Transaction txn;
+    createStoreTransaction(txn);
+
     while (1) {
         Path srcPath;
         Substitute sub;
@@ -188,8 +191,11 @@ static void opSubstitute(Strings opFlags, Strings opArgs)
             sub.args.push_back(s);
         }
         if (!cin || cin.eof()) throw Error("missing input");
-        registerSubstitute(srcPath, sub);
+        cerr << ".";
+        registerSubstitute(txn, srcPath, sub);
     }
+
+    txn.commit();
 }