2003-06-16 13:33:38 +00:00
|
|
|
#ifndef __GLOBALS_H
|
|
|
|
#define __GLOBALS_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2003-07-31 13:47:13 +00:00
|
|
|
#include "db.hh"
|
|
|
|
|
2003-06-16 13:33:38 +00:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
2003-07-31 13:47:13 +00:00
|
|
|
extern Database nixDB;
|
|
|
|
|
|
|
|
|
|
|
|
/* Database tables. */
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-06-27 13:55:12 +00:00
|
|
|
|
2003-10-08 15:06:59 +00:00
|
|
|
/* dbValidPaths :: Path -> ()
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-10-08 15:06:59 +00:00
|
|
|
The existence of a key $p$ indicates that path $p$ is valid (that
|
|
|
|
is, produced by a succesful build). */
|
|
|
|
extern TableId dbValidPaths;
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-07-15 16:28:54 +00:00
|
|
|
|
2003-10-08 15:06:59 +00:00
|
|
|
/* dbSuccessors :: Path -> Path
|
2003-07-15 16:28:54 +00:00
|
|
|
|
2003-10-08 15:06:59 +00:00
|
|
|
Each pair $(p_1, p_2)$ in this mapping records the fact that the
|
|
|
|
Nix expression stored at path $p_1$ has a successor expression
|
|
|
|
stored at path $p_2$.
|
2003-07-15 16:28:54 +00:00
|
|
|
|
2003-10-08 15:06:59 +00:00
|
|
|
Note that a term $y$ is a successor of $x$ iff there exists a
|
2003-07-04 15:29:58 +00:00
|
|
|
sequence of rewrite steps that rewrites $x$ into $y$.
|
|
|
|
*/
|
2003-07-31 16:05:35 +00:00
|
|
|
extern TableId dbSuccessors;
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-07-09 16:12:40 +00:00
|
|
|
|
2003-10-10 14:46:28 +00:00
|
|
|
/* dbSuccessorsRev :: Path -> [Path]
|
|
|
|
|
|
|
|
The reverse mapping of dbSuccessors.
|
|
|
|
*/
|
|
|
|
extern TableId dbSuccessorsRev;
|
|
|
|
|
|
|
|
|
2003-10-08 15:06:59 +00:00
|
|
|
/* dbSubstitutes :: Path -> [Path]
|
2003-07-15 16:28:54 +00:00
|
|
|
|
2003-10-08 15:06:59 +00:00
|
|
|
Each pair $(p, [ps])$ tells Nix that it can realise any of the
|
|
|
|
Nix expressions stored at paths $ps$ to produce a path $p$.
|
2003-07-09 16:12:40 +00:00
|
|
|
|
|
|
|
The main purpose of this is for distributed caching of derivates.
|
2003-10-08 15:06:59 +00:00
|
|
|
One system can compute a derivate and put it on a website (as a Nix
|
|
|
|
archive), for instance, and then another system can register a
|
|
|
|
substitute for that derivate. The substitute in this case might be
|
|
|
|
a Nix expression that fetches the Nix archive.
|
2003-07-09 16:12:40 +00:00
|
|
|
*/
|
2003-07-31 16:05:35 +00:00
|
|
|
extern TableId dbSubstitutes;
|
2003-07-09 16:12:40 +00:00
|
|
|
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-10-10 14:46:28 +00:00
|
|
|
/* dbSubstitutesRev :: Path -> [Path]
|
|
|
|
|
|
|
|
The reverse mapping of dbSubstitutes.
|
|
|
|
*/
|
|
|
|
extern TableId dbSubstitutesRev;
|
|
|
|
|
|
|
|
|
2003-06-16 13:33:38 +00:00
|
|
|
/* Path names. */
|
|
|
|
|
2003-06-27 13:55:12 +00:00
|
|
|
/* nixStore is the directory where we generally store atomic and
|
|
|
|
derived files. */
|
|
|
|
extern string nixStore;
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-07-10 13:41:28 +00:00
|
|
|
extern string nixDataDir; /* !!! fix */
|
|
|
|
|
2003-06-27 13:55:12 +00:00
|
|
|
/* nixLogDir is the directory where we log various operations. */
|
2003-06-16 13:33:38 +00:00
|
|
|
extern string nixLogDir;
|
|
|
|
|
2003-07-31 13:47:13 +00:00
|
|
|
/* nixDBPath is the path name of our Berkeley DB environment. */
|
|
|
|
extern string nixDBPath;
|
|
|
|
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-08-19 09:04:47 +00:00
|
|
|
/* Misc. global flags. */
|
|
|
|
|
|
|
|
/* Whether to keep temporary directories of failed builds. */
|
|
|
|
extern bool keepFailed;
|
|
|
|
|
|
|
|
|
2003-07-31 13:47:13 +00:00
|
|
|
/* Open the database environment. */
|
|
|
|
void openDB();
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-07-31 13:47:13 +00:00
|
|
|
/* Create the required database tables. */
|
2003-06-16 13:33:38 +00:00
|
|
|
void initDB();
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* !__GLOBALS_H */
|