about summary refs log tree commit diff
path: root/src/nix-env/profiles.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-04-21T15·08+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-04-21T15·08+0000
commitfe2d869e04372de69719c3989a75247ff44b8fd4 (patch)
treece7df351314663d45adaa6a3b7ba4c64f179c63a /src/nix-env/profiles.hh
parentf3b8833a48472c3545ea8673d687ea9cadcedd61 (diff)
* Store user environment manifests as a Nix expression in
  $out/manifest.nix rather than as an ATerm.

  (Hm, I thought I committed this two days ago...)

Diffstat (limited to 'src/nix-env/profiles.hh')
-rw-r--r--src/nix-env/profiles.hh15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nix-env/profiles.hh b/src/nix-env/profiles.hh
index 99c20f42d1..a64258dae2 100644
--- a/src/nix-env/profiles.hh
+++ b/src/nix-env/profiles.hh
@@ -2,6 +2,7 @@
 #define __PROFILES_H
 
 #include "types.hh"
+#include "pathlocks.hh"
 
 #include <time.h>
 
@@ -37,6 +38,20 @@ void deleteGeneration(const Path & profile, unsigned int gen);
 
 void switchLink(Path link, Path target);
 
+/* Ensure exclusive access to a profile.  Any command that modifies
+   the profile first acquires this lock. */
+void lockProfile(PathLocks & lock, const Path & profile);
+
+/* Optimistic locking is used by long-running operations like `nix-env
+   -i'.  Instead of acquiring the exclusive lock for the entire
+   duration of the operation, we just perform the operation
+   optimistically (without an exclusive lock), and check at the end
+   whether the profile changed while we were busy (i.e., the symlink
+   target changed).  If so, the operation is restarted.  Restarting is
+   generally cheap, since the build results are still in the Nix
+   store.  Most of the time, only the user environment has to be
+   rebuilt. */
+string optimisticLockProfile(const Path & profile);
 
 }