/* Nix store and database schema version. Version 1 (or 0) was Nix <=
0.7. Version 2 was Nix 0.8 and 0.9. Version 3 is Nix 0.10.
Version 4 is Nix 0.11. Version 5 is Nix 0.12-0.16. Version 6 is
- Nix 1.0. Version 7 is Nix 1.3. */
+ Nix 1.0. Version 7 is Nix 1.3. Guix has always used version 7. */
const int nixSchemaVersion = 7;
};
-struct RunningSubstituter
-{
- Path program;
- Pid pid;
- AutoCloseFD to, from, error;
- FdSource fromBuf;
- bool disabled;
- RunningSubstituter() : disabled(false) { };
-};
-
-
class LocalStore : public StoreAPI
{
private:
- typedef std::map<Path, RunningSubstituter> RunningSubstituters;
- RunningSubstituters runningSubstituters;
+ /* The currently running substituter or empty. */
+ std::shared_ptr<Agent> runningSubstituter;
+
+ /* Ensure the substituter is running and return it. */
+ std::shared_ptr<Agent> substituter();
Path linksDir;
PathSet querySubstitutablePaths(const PathSet & paths);
- void querySubstitutablePathInfos(const Path & substituter,
- PathSet & paths, SubstitutablePathInfos & infos);
+ void querySubstitutablePathInfos(PathSet & paths,
+ SubstitutablePathInfos & infos);
void querySubstitutablePathInfos(const PathSet & paths,
SubstitutablePathInfos & infos);
void markContentsGood(const Path & path);
- void setSubstituterEnv();
+ void createUser(const std::string & userName, uid_t userId);
private:
/* Cache for pathContentsGood(). */
std::map<Path, bool> pathContentsGoodCache;
- bool didSetSubstituterEnv;
-
/* The file to which we write our temporary roots. */
Path fnTempRoots;
AutoCloseFD fdTempRoots;
void updatePathInfo(const ValidPathInfo & info);
- void upgradeStore6();
- void upgradeStore7();
- PathSet queryValidPathsOld();
- ValidPathInfo queryPathInfoOld(const Path & path);
-
struct GCState;
void deleteGarbage(GCState & state, const Path & path);
void removeUnusedLinks(const GCState & state);
- void startSubstituter(const Path & substituter,
- RunningSubstituter & runningSubstituter);
+ string getLineFromSubstituter(Agent & run);
- string getLineFromSubstituter(RunningSubstituter & run);
-
- template<class T> T getIntLineFromSubstituter(RunningSubstituter & run);
+ template<class T> T getIntLineFromSubstituter(Agent & run);
Path createTempDirInStore();
MakeError(PathInUse, Error);
+/* Size below which a file is not considered for deduplication. */
+extern const size_t deduplicationMinSize;
+
}