2003-06-16 13:33:38 +00:00
|
|
|
#ifndef __GLOBALS_H
|
|
|
|
#define __GLOBALS_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
/* Database names. */
|
|
|
|
|
2003-07-08 08:35:06 +00:00
|
|
|
/* dbHash2Paths :: Hash -> [Path]
|
2003-06-27 13:55:12 +00:00
|
|
|
|
2003-07-08 08:35:06 +00:00
|
|
|
Maintains a mapping from hashes to lists of paths. This is what we
|
|
|
|
use to resolve Hash(hash) content descriptors. */
|
|
|
|
extern string dbHash2Paths;
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-07-04 12:18:06 +00:00
|
|
|
/* dbSuccessors :: Hash -> Hash
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-07-04 12:18:06 +00:00
|
|
|
Each pair (h1, h2) in this mapping records the fact that a
|
|
|
|
successor of an fstate expression with hash h1 is stored in a file
|
|
|
|
with hash h2.
|
2003-06-17 15:45:43 +00:00
|
|
|
|
2003-07-04 12:18:06 +00:00
|
|
|
Note that a term $y$ is successor of $x$ iff there exists a
|
2003-07-04 15:29:58 +00:00
|
|
|
sequence of rewrite steps that rewrites $x$ into $y$.
|
|
|
|
|
|
|
|
Also note that instead of a successor, $y$ can be any term
|
|
|
|
equivalent to $x$, that is, reducing to the same result, as long as
|
|
|
|
$x$ is equal to or a successor of $y$. (This is useful, e.g., for
|
|
|
|
shared derivate caching over the network).
|
|
|
|
*/
|
2003-07-04 12:18:06 +00:00
|
|
|
extern string dbSuccessors;
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2003-07-09 16:12:40 +00:00
|
|
|
/* dbSubstitutes :: Hash -> [Hash]
|
|
|
|
|
|
|
|
Each pair $(h, [hs])$ tells Nix that it can realise any of the
|
|
|
|
fstate expressions referenced by the hashes in $hs$ to obtain a Nix
|
|
|
|
archive that, when unpacked, will produce a path with hash $h$.
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
extern string dbSubstitutes;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
/* nixDB is the file name of the Berkeley DB database where we
|
|
|
|
maintain the dbXXX mappings. */
|
|
|
|
extern string nixDB;
|
|
|
|
|
|
|
|
|
|
|
|
/* Initialize the databases. */
|
|
|
|
void initDB();
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* !__GLOBALS_H */
|