2003-06-16 16:33:38 +03:00
|
|
|
#ifndef __GLOBALS_H
|
|
|
|
#define __GLOBALS_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2003-07-31 16:47:13 +03:00
|
|
|
#include "db.hh"
|
|
|
|
|
2003-06-16 16:33:38 +03:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
2003-07-31 16:47:13 +03:00
|
|
|
extern Database nixDB;
|
|
|
|
|
|
|
|
|
|
|
|
/* Database tables. */
|
2003-06-16 16:33:38 +03:00
|
|
|
|
2003-07-15 19:28:54 +03:00
|
|
|
/* dbPath2Id :: Path -> FSId
|
2003-06-27 16:55:12 +03:00
|
|
|
|
2003-07-15 19:28:54 +03:00
|
|
|
Each pair (p, id) records that path $p$ contains an expansion of
|
|
|
|
$id$. */
|
2003-07-31 19:05:35 +03:00
|
|
|
extern TableId dbPath2Id;
|
2003-06-16 16:33:38 +03:00
|
|
|
|
|
|
|
|
2003-07-15 19:28:54 +03:00
|
|
|
/* dbId2Paths :: FSId -> [Path]
|
|
|
|
|
|
|
|
A mapping from ids to lists of paths. */
|
2003-07-31 19:05:35 +03:00
|
|
|
extern TableId dbId2Paths;
|
2003-07-15 19:28:54 +03:00
|
|
|
|
|
|
|
|
|
|
|
/* dbSuccessors :: FSId -> FSId
|
|
|
|
|
|
|
|
Each pair $(id_1, id_2)$ in this mapping records the fact that a
|
|
|
|
successor of an fstate expression stored in a file with identifier
|
|
|
|
$id_1$ is stored in a file with identifier $id_2$.
|
2003-06-17 18:45:43 +03:00
|
|
|
|
2003-07-04 15:18:06 +03:00
|
|
|
Note that a term $y$ is successor of $x$ iff there exists a
|
2003-07-04 18:29:58 +03:00
|
|
|
sequence of rewrite steps that rewrites $x$ into $y$.
|
|
|
|
*/
|
2003-07-31 19:05:35 +03:00
|
|
|
extern TableId dbSuccessors;
|
2003-06-16 16:33:38 +03:00
|
|
|
|
2003-07-09 19:12:40 +03:00
|
|
|
|
2003-07-15 19:28:54 +03:00
|
|
|
/* dbSubstitutes :: FSId -> [FSId]
|
|
|
|
|
|
|
|
Each pair $(id, [ids])$ tells Nix that it can realise any of the
|
|
|
|
fstate expressions referenced by the identifiers in $ids$ to
|
|
|
|
generate a path with identifier $id$.
|
2003-07-09 19:12:40 +03:00
|
|
|
|
|
|
|
The main purpose of this is for distributed caching of derivates.
|
|
|
|
One system can compute a derivate with hash $h$ 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 an fstate expression that fetches the Nix
|
|
|
|
archive.
|
|
|
|
*/
|
2003-07-31 19:05:35 +03:00
|
|
|
extern TableId dbSubstitutes;
|
2003-07-09 19:12:40 +03:00
|
|
|
|
2003-06-16 16:33:38 +03:00
|
|
|
|
|
|
|
/* Path names. */
|
|
|
|
|
2003-06-27 16:55:12 +03:00
|
|
|
/* nixStore is the directory where we generally store atomic and
|
|
|
|
derived files. */
|
|
|
|
extern string nixStore;
|
2003-06-16 16:33:38 +03:00
|
|
|
|
2003-07-10 16:41:28 +03:00
|
|
|
extern string nixDataDir; /* !!! fix */
|
|
|
|
|
2003-06-27 16:55:12 +03:00
|
|
|
/* nixLogDir is the directory where we log various operations. */
|
2003-06-16 16:33:38 +03:00
|
|
|
extern string nixLogDir;
|
|
|
|
|
2003-07-31 16:47:13 +03:00
|
|
|
/* nixDBPath is the path name of our Berkeley DB environment. */
|
|
|
|
extern string nixDBPath;
|
|
|
|
|
2003-06-16 16:33:38 +03:00
|
|
|
|
2003-07-31 16:47:13 +03:00
|
|
|
/* Open the database environment. */
|
|
|
|
void openDB();
|
2003-06-16 16:33:38 +03:00
|
|
|
|
2003-07-31 16:47:13 +03:00
|
|
|
/* Create the required database tables. */
|
2003-06-16 16:33:38 +03:00
|
|
|
void initDB();
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* !__GLOBALS_H */
|