2006-11-30 18:43:04 +01:00
|
|
|
|
#ifndef __STOREAPI_H
|
|
|
|
|
#define __STOREAPI_H
|
|
|
|
|
|
2010-10-04 19:55:38 +02:00
|
|
|
|
#include "hash.hh"
|
|
|
|
|
#include "serialise.hh"
|
|
|
|
|
|
2006-11-30 18:43:04 +01:00
|
|
|
|
#include <string>
|
2006-12-05 02:31:45 +01:00
|
|
|
|
#include <map>
|
2006-11-30 18:43:04 +01:00
|
|
|
|
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
|
|
|
2006-12-05 02:31:45 +01:00
|
|
|
|
typedef std::map<Path, Path> Roots;
|
|
|
|
|
|
|
|
|
|
|
2008-06-18 11:34:17 +02:00
|
|
|
|
struct GCOptions
|
|
|
|
|
{
|
|
|
|
|
/* Garbage collector operation:
|
|
|
|
|
|
|
|
|
|
- `gcReturnLive': return the set of paths reachable from
|
|
|
|
|
(i.e. in the closure of) the roots.
|
|
|
|
|
|
|
|
|
|
- `gcReturnDead': return the set of paths not reachable from
|
|
|
|
|
the roots.
|
|
|
|
|
|
|
|
|
|
- `gcDeleteDead': actually delete the latter set.
|
|
|
|
|
|
|
|
|
|
- `gcDeleteSpecific': delete the paths listed in
|
|
|
|
|
`pathsToDelete', insofar as they are not reachable.
|
|
|
|
|
*/
|
|
|
|
|
typedef enum {
|
|
|
|
|
gcReturnLive,
|
|
|
|
|
gcReturnDead,
|
|
|
|
|
gcDeleteDead,
|
|
|
|
|
gcDeleteSpecific,
|
|
|
|
|
} GCAction;
|
|
|
|
|
|
|
|
|
|
GCAction action;
|
|
|
|
|
|
|
|
|
|
/* If `ignoreLiveness' is set, then reachability from the roots is
|
|
|
|
|
ignored (dangerous!). However, the paths must still be
|
|
|
|
|
unreferenced *within* the store (i.e., there can be no other
|
|
|
|
|
store paths that depend on them). */
|
|
|
|
|
bool ignoreLiveness;
|
|
|
|
|
|
|
|
|
|
/* For `gcDeleteSpecific', the paths to delete. */
|
|
|
|
|
PathSet pathsToDelete;
|
|
|
|
|
|
2009-03-26 12:02:07 +01:00
|
|
|
|
/* Stop after at least `maxFreed' bytes have been freed. 0 means
|
|
|
|
|
no limit. */
|
2008-06-18 11:34:17 +02:00
|
|
|
|
unsigned long long maxFreed;
|
|
|
|
|
|
2008-06-18 16:20:16 +02:00
|
|
|
|
GCOptions();
|
2008-06-18 11:34:17 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct GCResults
|
|
|
|
|
{
|
|
|
|
|
/* Depending on the action, the GC roots, or the paths that would
|
|
|
|
|
be or have been deleted. */
|
|
|
|
|
PathSet paths;
|
|
|
|
|
|
|
|
|
|
/* For `gcReturnDead', `gcDeleteDead' and `gcDeleteSpecific', the
|
|
|
|
|
number of bytes that would be or was freed. */
|
|
|
|
|
unsigned long long bytesFreed;
|
|
|
|
|
|
|
|
|
|
/* The number of file system blocks that would be or was freed. */
|
|
|
|
|
unsigned long long blocksFreed;
|
|
|
|
|
|
|
|
|
|
GCResults()
|
|
|
|
|
{
|
|
|
|
|
bytesFreed = 0;
|
|
|
|
|
blocksFreed = 0;
|
|
|
|
|
}
|
|
|
|
|
};
|
2006-12-05 03:18:46 +01:00
|
|
|
|
|
|
|
|
|
|
2008-08-02 14:54:35 +02:00
|
|
|
|
struct SubstitutablePathInfo
|
|
|
|
|
{
|
|
|
|
|
Path deriver;
|
|
|
|
|
PathSet references;
|
|
|
|
|
unsigned long long downloadSize; /* 0 = unknown or inapplicable */
|
2010-11-17 15:31:42 +01:00
|
|
|
|
unsigned long long narSize; /* 0 = unknown */
|
2008-08-02 14:54:35 +02:00
|
|
|
|
};
|
|
|
|
|
|
download-from-binary-cache: parallelise fetching of NAR info files
Getting substitute information using the binary cache substituter has
non-trivial latency overhead. A package or NixOS system configuration
can have hundreds of dependencies, and in the worst case (when the
local info cache is empty) we have to do a separate HTTP request for
each of these. If the ping time to the server is t, getting N info
files will take tN seconds; e.g., with a ping time of 0.1s to
nixos.org, sequentially downloading 1000 info files (a typical NixOS
config) will take at least 100 seconds.
To fix this problem, the binary cache substituter can now perform
requests in parallel. This required changing the substituter
interface to support a function querySubstitutablePathInfos() that
queries multiple paths at the same time, and rewriting queryMissing()
to take advantage of parallelism. (Due to local caching,
parallelising queryMissing() is sufficient for most use cases, since
it's almost always called before building a derivation and thus fills
the local info cache.)
For example, parallelism speeds up querying all 1056 paths in a
particular NixOS system configuration from 116s to 2.6s. It works so
well because the eccentricity of the top-level derivation in the
dependency graph is only 9. So we only need 10 round-trips (when
using an unlimited number of parallel connections) to get everything.
Currently we do a maximum of 150 parallel connections to the server.
Thus it's important that the binary cache server (e.g. nixos.org) has
a high connection limit. Alternatively we could use HTTP pipelining,
but WWW::Curl doesn't support it and libcurl has a hard-coded limit of
5 requests per pipeline.
2012-07-07 01:08:20 +02:00
|
|
|
|
typedef std::map<Path, SubstitutablePathInfo> SubstitutablePathInfos;
|
|
|
|
|
|
2008-08-02 14:54:35 +02:00
|
|
|
|
|
2010-11-16 18:11:46 +01:00
|
|
|
|
struct ValidPathInfo
|
|
|
|
|
{
|
|
|
|
|
Path path;
|
|
|
|
|
Path deriver;
|
|
|
|
|
Hash hash;
|
|
|
|
|
PathSet references;
|
|
|
|
|
time_t registrationTime;
|
|
|
|
|
unsigned long long narSize; // 0 = unknown
|
|
|
|
|
unsigned long long id; // internal use only
|
|
|
|
|
ValidPathInfo() : registrationTime(0), narSize(0) { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef list<ValidPathInfo> ValidPathInfos;
|
|
|
|
|
|
|
|
|
|
|
2006-11-30 18:43:04 +01:00
|
|
|
|
class StoreAPI
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual ~StoreAPI() { }
|
|
|
|
|
|
2012-07-11 16:49:04 +02:00
|
|
|
|
/* Check whether a path is valid. */
|
2006-11-30 18:43:04 +01:00
|
|
|
|
virtual bool isValidPath(const Path & path) = 0;
|
|
|
|
|
|
2012-07-11 17:08:47 +02:00
|
|
|
|
/* Query which of the given paths is valid. */
|
|
|
|
|
virtual PathSet queryValidPaths(const PathSet & paths) = 0;
|
|
|
|
|
|
2012-07-11 16:49:04 +02:00
|
|
|
|
/* Query the set of all valid paths. */
|
|
|
|
|
virtual PathSet queryAllValidPaths() = 0;
|
2008-01-29 19:17:36 +01:00
|
|
|
|
|
2010-11-16 18:11:46 +01:00
|
|
|
|
/* Query information about a valid path. */
|
|
|
|
|
virtual ValidPathInfo queryPathInfo(const Path & path) = 0;
|
|
|
|
|
|
2012-07-11 16:49:04 +02:00
|
|
|
|
/* Query the hash of a valid path. */
|
2006-11-30 18:43:04 +01:00
|
|
|
|
virtual Hash queryPathHash(const Path & path) = 0;
|
|
|
|
|
|
2012-07-11 16:49:04 +02:00
|
|
|
|
/* Query the set of outgoing FS references for a store path. The
|
|
|
|
|
result is not cleared. */
|
2006-12-01 19:00:01 +01:00
|
|
|
|
virtual void queryReferences(const Path & path,
|
2006-11-30 18:43:04 +01:00
|
|
|
|
PathSet & references) = 0;
|
|
|
|
|
|
|
|
|
|
/* Queries the set of incoming FS references for a store path.
|
|
|
|
|
The result is not cleared. */
|
2006-12-01 19:00:01 +01:00
|
|
|
|
virtual void queryReferrers(const Path & path,
|
2006-11-30 18:43:04 +01:00
|
|
|
|
PathSet & referrers) = 0;
|
|
|
|
|
|
2007-06-12 18:53:44 +02:00
|
|
|
|
/* Query the deriver of a store path. Return the empty string if
|
|
|
|
|
no deriver has been set. */
|
|
|
|
|
virtual Path queryDeriver(const Path & path) = 0;
|
|
|
|
|
|
2010-02-22 13:44:36 +01:00
|
|
|
|
/* Query the outputs of the derivation denoted by `path'. */
|
|
|
|
|
virtual PathSet queryDerivationOutputs(const Path & path) = 0;
|
2011-11-06 07:28:20 +01:00
|
|
|
|
|
|
|
|
|
/* Query the output names of the derivation denoted by `path'. */
|
|
|
|
|
virtual StringSet queryDerivationOutputNames(const Path & path) = 0;
|
2010-02-22 13:44:36 +01:00
|
|
|
|
|
2008-08-02 14:54:35 +02:00
|
|
|
|
/* Query whether a path has substitutes. */
|
|
|
|
|
virtual bool hasSubstitutes(const Path & path) = 0;
|
2007-08-12 02:29:28 +02:00
|
|
|
|
|
2012-07-11 16:43:24 +02:00
|
|
|
|
/* Query substitute info (i.e. references, derivers and download
|
|
|
|
|
sizes) of a set of paths. If a path does not have substitute
|
|
|
|
|
info, it's omitted from the resulting ‘infos’ map. */
|
download-from-binary-cache: parallelise fetching of NAR info files
Getting substitute information using the binary cache substituter has
non-trivial latency overhead. A package or NixOS system configuration
can have hundreds of dependencies, and in the worst case (when the
local info cache is empty) we have to do a separate HTTP request for
each of these. If the ping time to the server is t, getting N info
files will take tN seconds; e.g., with a ping time of 0.1s to
nixos.org, sequentially downloading 1000 info files (a typical NixOS
config) will take at least 100 seconds.
To fix this problem, the binary cache substituter can now perform
requests in parallel. This required changing the substituter
interface to support a function querySubstitutablePathInfos() that
queries multiple paths at the same time, and rewriting queryMissing()
to take advantage of parallelism. (Due to local caching,
parallelising queryMissing() is sufficient for most use cases, since
it's almost always called before building a derivation and thus fills
the local info cache.)
For example, parallelism speeds up querying all 1056 paths in a
particular NixOS system configuration from 116s to 2.6s. It works so
well because the eccentricity of the top-level derivation in the
dependency graph is only 9. So we only need 10 round-trips (when
using an unlimited number of parallel connections) to get everything.
Currently we do a maximum of 150 parallel connections to the server.
Thus it's important that the binary cache server (e.g. nixos.org) has
a high connection limit. Alternatively we could use HTTP pipelining,
but WWW::Curl doesn't support it and libcurl has a hard-coded limit of
5 requests per pipeline.
2012-07-07 01:08:20 +02:00
|
|
|
|
virtual void querySubstitutablePathInfos(const PathSet & paths,
|
|
|
|
|
SubstitutablePathInfos & infos) = 0;
|
2007-08-12 02:29:28 +02:00
|
|
|
|
|
2006-11-30 18:43:04 +01:00
|
|
|
|
/* Copy the contents of a path to the store and register the
|
2006-12-01 21:51:18 +01:00
|
|
|
|
validity the resulting path. The resulting path is returned.
|
2011-12-01 14:48:48 +01:00
|
|
|
|
The function object `filter' can be used to exclude files (see
|
2006-12-13 00:05:01 +01:00
|
|
|
|
libutil/archive.hh). */
|
2008-12-03 16:06:30 +01:00
|
|
|
|
virtual Path addToStore(const Path & srcPath,
|
2008-12-03 17:10:17 +01:00
|
|
|
|
bool recursive = true, HashType hashAlgo = htSHA256,
|
2006-12-13 00:05:01 +01:00
|
|
|
|
PathFilter & filter = defaultPathFilter) = 0;
|
2006-11-30 18:43:04 +01:00
|
|
|
|
|
|
|
|
|
/* Like addToStore, but the contents written to the output path is
|
|
|
|
|
a regular file containing the given string. */
|
2008-12-03 16:06:30 +01:00
|
|
|
|
virtual Path addTextToStore(const string & name, const string & s,
|
2006-11-30 18:43:04 +01:00
|
|
|
|
const PathSet & references) = 0;
|
2006-11-30 19:02:04 +01:00
|
|
|
|
|
2007-02-21 00:17:20 +01:00
|
|
|
|
/* Export a store path, that is, create a NAR dump of the store
|
|
|
|
|
path and append its references and its deriver. Optionally, a
|
|
|
|
|
cryptographic signature (created by OpenSSL) of the preceding
|
|
|
|
|
data is attached. */
|
|
|
|
|
virtual void exportPath(const Path & path, bool sign,
|
|
|
|
|
Sink & sink) = 0;
|
|
|
|
|
|
2011-12-16 23:31:25 +01:00
|
|
|
|
/* Import a sequence of NAR dumps created by exportPaths() into
|
|
|
|
|
the Nix store. */
|
|
|
|
|
virtual Paths importPaths(bool requireSignature, Source & source) = 0;
|
2007-02-21 16:45:32 +01:00
|
|
|
|
|
2012-06-27 22:58:15 +02:00
|
|
|
|
/* For each path, if it's a derivation, build it. Building a
|
|
|
|
|
derivation means ensuring that the output paths are valid. If
|
2006-11-30 19:02:04 +01:00
|
|
|
|
they are already valid, this is a no-op. Otherwise, validity
|
2007-08-12 02:29:28 +02:00
|
|
|
|
can be reached in two ways. First, if the output paths is
|
|
|
|
|
substitutable, then build the path that way. Second, the
|
|
|
|
|
output paths can be created by running the builder, after
|
2012-06-27 22:58:15 +02:00
|
|
|
|
recursively building any sub-derivations. For inputs that are
|
|
|
|
|
not derivations, substitute them. */
|
|
|
|
|
virtual void buildPaths(const PathSet & paths) = 0;
|
2006-11-30 19:02:04 +01:00
|
|
|
|
|
|
|
|
|
/* Ensure that a path is valid. If it is not currently valid, it
|
|
|
|
|
may be made valid by running a substitute (if defined for the
|
|
|
|
|
path). */
|
2006-12-01 19:00:01 +01:00
|
|
|
|
virtual void ensurePath(const Path & path) = 0;
|
2006-12-02 17:41:36 +01:00
|
|
|
|
|
|
|
|
|
/* Add a store path as a temporary root of the garbage collector.
|
|
|
|
|
The root disappears as soon as we exit. */
|
|
|
|
|
virtual void addTempRoot(const Path & path) = 0;
|
|
|
|
|
|
2006-12-05 00:29:16 +01:00
|
|
|
|
/* Add an indirect root, which is merely a symlink to `path' from
|
|
|
|
|
/nix/var/nix/gcroots/auto/<hash of `path'>. `path' is supposed
|
|
|
|
|
to be a symlink to a store path. The garbage collector will
|
|
|
|
|
automatically remove the indirect root when it finds that
|
|
|
|
|
`path' has disappeared. */
|
|
|
|
|
virtual void addIndirectRoot(const Path & path) = 0;
|
|
|
|
|
|
2006-12-02 17:41:36 +01:00
|
|
|
|
/* Acquire the global GC lock, then immediately release it. This
|
|
|
|
|
function must be called after registering a new permanent root,
|
|
|
|
|
but before exiting. Otherwise, it is possible that a running
|
|
|
|
|
garbage collector doesn't see the new root and deletes the
|
|
|
|
|
stuff we've just built. By acquiring the lock briefly, we
|
|
|
|
|
ensure that either:
|
|
|
|
|
|
|
|
|
|
- The collector is already running, and so we block until the
|
|
|
|
|
collector is finished. The collector will know about our
|
|
|
|
|
*temporary* locks, which should include whatever it is we
|
|
|
|
|
want to register as a permanent lock.
|
|
|
|
|
|
|
|
|
|
- The collector isn't running, or it's just started but hasn't
|
|
|
|
|
acquired the GC lock yet. In that case we get and release
|
|
|
|
|
the lock right away, then exit. The collector scans the
|
|
|
|
|
permanent root and sees our's.
|
|
|
|
|
|
|
|
|
|
In either case the permanent root is seen by the collector. */
|
|
|
|
|
virtual void syncWithGC() = 0;
|
|
|
|
|
|
2006-12-05 02:31:45 +01:00
|
|
|
|
/* Find the roots of the garbage collector. Each root is a pair
|
|
|
|
|
(link, storepath) where `link' is the path of the symlink
|
|
|
|
|
outside of the Nix store that point to `storePath'. */
|
|
|
|
|
virtual Roots findRoots() = 0;
|
|
|
|
|
|
2008-06-18 11:34:17 +02:00
|
|
|
|
/* Perform a garbage collection. */
|
|
|
|
|
virtual void collectGarbage(const GCOptions & options, GCResults & results) = 0;
|
2010-05-04 12:45:10 +02:00
|
|
|
|
|
|
|
|
|
/* Return the set of paths that have failed to build.*/
|
|
|
|
|
virtual PathSet queryFailedPaths() = 0;
|
|
|
|
|
|
|
|
|
|
/* Clear the "failed" status of the given paths. The special
|
|
|
|
|
value `*' causes all failed paths to be cleared. */
|
|
|
|
|
virtual void clearFailedPaths(const PathSet & paths) = 0;
|
2010-11-16 18:11:46 +01:00
|
|
|
|
|
|
|
|
|
/* Return a string representing information about the path that
|
|
|
|
|
can be loaded into the database using `nix-store --load-db' or
|
|
|
|
|
`nix-store --register-validity'. */
|
|
|
|
|
string makeValidityRegistration(const PathSet & paths,
|
|
|
|
|
bool showDerivers, bool showHash);
|
2006-11-30 18:43:04 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* !!! These should be part of the store API, I guess. */
|
|
|
|
|
|
|
|
|
|
/* Throw an exception if `path' is not directly in the Nix store. */
|
|
|
|
|
void assertStorePath(const Path & path);
|
|
|
|
|
|
|
|
|
|
bool isInStore(const Path & path);
|
|
|
|
|
bool isStorePath(const Path & path);
|
|
|
|
|
|
2011-07-20 20:10:47 +02:00
|
|
|
|
/* Extract the name part of the given store path. */
|
|
|
|
|
string storePathToName(const Path & path);
|
|
|
|
|
|
2006-11-30 18:43:04 +01:00
|
|
|
|
void checkStoreName(const string & name);
|
|
|
|
|
|
2007-11-29 17:18:24 +01:00
|
|
|
|
|
2006-11-30 18:43:04 +01:00
|
|
|
|
/* Chop off the parts after the top-level store name, e.g.,
|
|
|
|
|
/nix/store/abcd-foo/bar => /nix/store/abcd-foo. */
|
|
|
|
|
Path toStorePath(const Path & path);
|
|
|
|
|
|
|
|
|
|
|
2007-11-29 17:18:24 +01:00
|
|
|
|
/* Follow symlinks until we end up with a path in the Nix store. */
|
|
|
|
|
Path followLinksToStore(const Path & path);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Same as followLinksToStore(), but apply toStorePath() to the
|
|
|
|
|
result. */
|
|
|
|
|
Path followLinksToStorePath(const Path & path);
|
|
|
|
|
|
|
|
|
|
|
2006-11-30 18:43:04 +01:00
|
|
|
|
/* Constructs a unique store path name. */
|
|
|
|
|
Path makeStorePath(const string & type,
|
2008-12-03 16:06:30 +01:00
|
|
|
|
const Hash & hash, const string & name);
|
2006-11-30 18:43:04 +01:00
|
|
|
|
|
2011-07-20 20:10:47 +02:00
|
|
|
|
Path makeOutputPath(const string & id,
|
|
|
|
|
const Hash & hash, const string & name);
|
|
|
|
|
|
2006-11-30 18:43:04 +01:00
|
|
|
|
Path makeFixedOutputPath(bool recursive,
|
2008-12-03 17:10:17 +01:00
|
|
|
|
HashType hashAlgo, Hash hash, string name);
|
2006-11-30 18:43:04 +01:00
|
|
|
|
|
|
|
|
|
|
2006-12-01 19:00:01 +01:00
|
|
|
|
/* This is the preparatory part of addToStore() and addToStoreFixed();
|
|
|
|
|
it computes the store path to which srcPath is to be copied.
|
|
|
|
|
Returns the store path and the cryptographic hash of the
|
|
|
|
|
contents of srcPath. */
|
2006-12-01 21:51:18 +01:00
|
|
|
|
std::pair<Path, Hash> computeStorePathForPath(const Path & srcPath,
|
2008-12-03 17:10:17 +01:00
|
|
|
|
bool recursive = true, HashType hashAlgo = htSHA256,
|
2006-12-13 00:05:01 +01:00
|
|
|
|
PathFilter & filter = defaultPathFilter);
|
2006-12-01 19:00:01 +01:00
|
|
|
|
|
|
|
|
|
/* Preparatory part of addTextToStore().
|
|
|
|
|
|
|
|
|
|
!!! Computation of the path should take the references given to
|
|
|
|
|
addTextToStore() into account, otherwise we have a (relatively
|
|
|
|
|
minor) security hole: a caller can register a source file with
|
|
|
|
|
bogus references. If there are too many references, the path may
|
|
|
|
|
not be garbage collected when it has to be (not really a problem,
|
|
|
|
|
the caller could create a root anyway), or it may be garbage
|
|
|
|
|
collected when it shouldn't be (more serious).
|
|
|
|
|
|
|
|
|
|
Hashing the references would solve this (bogus references would
|
|
|
|
|
simply yield a different store path, so other users wouldn't be
|
|
|
|
|
affected), but it has some backwards compatibility issues (the
|
|
|
|
|
hashing scheme changes), so I'm not doing that for now. */
|
2008-12-03 16:06:30 +01:00
|
|
|
|
Path computeStorePathForText(const string & name, const string & s,
|
2007-01-29 16:51:37 +01:00
|
|
|
|
const PathSet & references);
|
2006-12-01 19:00:01 +01:00
|
|
|
|
|
|
|
|
|
|
2006-12-05 03:18:46 +01:00
|
|
|
|
/* Remove the temporary roots file for this process. Any temporary
|
|
|
|
|
root becomes garbage after this point unless it has been registered
|
|
|
|
|
as a (permanent) root. */
|
|
|
|
|
void removeTempRoots();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Register a permanent GC root. */
|
2011-08-31 23:11:50 +02:00
|
|
|
|
Path addPermRoot(StoreAPI & store, const Path & storePath,
|
|
|
|
|
const Path & gcRoot, bool indirect, bool allowOutsideRootsDir = false);
|
2006-12-05 03:18:46 +01:00
|
|
|
|
|
|
|
|
|
|
2007-02-21 23:45:10 +01:00
|
|
|
|
/* Sort a set of paths topologically under the references relation.
|
|
|
|
|
If p refers to q, then p follows q in this list. */
|
2011-08-31 23:11:50 +02:00
|
|
|
|
Paths topoSortPaths(StoreAPI & store, const PathSet & paths);
|
2007-02-21 23:45:10 +01:00
|
|
|
|
|
|
|
|
|
|
2006-11-30 18:43:04 +01:00
|
|
|
|
/* For now, there is a single global store API object, but we'll
|
|
|
|
|
purify that in the future. */
|
|
|
|
|
extern boost::shared_ptr<StoreAPI> store;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Factory method: open the Nix database, either through the local or
|
|
|
|
|
remote implementation. */
|
2012-05-30 04:59:12 +02:00
|
|
|
|
boost::shared_ptr<StoreAPI> openStore(bool reserveSpace = true);
|
2008-06-09 15:52:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Display a set of paths in human-readable form (i.e., between quotes
|
|
|
|
|
and separated by commas). */
|
|
|
|
|
string showPaths(const PathSet & paths);
|
2006-11-30 18:43:04 +01:00
|
|
|
|
|
|
|
|
|
|
2008-01-29 19:17:36 +01:00
|
|
|
|
ValidPathInfo decodeValidPathInfo(std::istream & str,
|
|
|
|
|
bool hashGiven = false);
|
2007-08-12 02:29:28 +02:00
|
|
|
|
|
|
|
|
|
|
2011-11-23 16:13:37 +01:00
|
|
|
|
/* Export multiple paths in the format expected by ‘nix-store
|
|
|
|
|
--import’. */
|
|
|
|
|
void exportPaths(StoreAPI & store, const Paths & paths,
|
|
|
|
|
bool sign, Sink & sink);
|
|
|
|
|
|
|
|
|
|
|
2011-12-30 15:47:14 +01:00
|
|
|
|
MakeError(SubstError, Error)
|
|
|
|
|
MakeError(BuildError, Error) /* denotes a permanent build failure */
|
|
|
|
|
|
|
|
|
|
|
2006-11-30 18:43:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* !__STOREAPI_H */
|