diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-21T15·08+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-21T15·08+0000 |
commit | fe2d869e04372de69719c3989a75247ff44b8fd4 (patch) | |
tree | ce7df351314663d45adaa6a3b7ba4c64f179c63a /src/nix-env/profiles.hh | |
parent | f3b8833a48472c3545ea8673d687ea9cadcedd61 (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.hh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nix-env/profiles.hh b/src/nix-env/profiles.hh index 99c20f42d18c..a64258dae224 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); } |