forked from lix-project/lix
9e975458b4
need any info on substitutable paths, we just call the substituters (such as download-using-manifests.pl) directly. This means that it's no longer necessary for nix-pull to register substitutes or for nix-channel to clear them, which makes those operations much faster (NIX-95). Also, we don't have to worry about keeping nix-pull manifests (in /nix/var/nix/manifests) and the database in sync with each other. The downside is that there is some overhead in calling an external program to get the substitutes info. For instance, "nix-env -qas" takes a bit longer. Abolishing the substitutes table also makes the logic in local-store.cc simpler, as we don't need to store info for invalid paths. On the downside, you cannot do things like "nix-store -qR" on a substitutable but invalid path (but nobody did that anyway). * Never catch interrupts (the Interrupted exception).
87 lines
1.7 KiB
C++
87 lines
1.7 KiB
C++
#ifndef __REMOTE_STORE_H
|
|
#define __REMOTE_STORE_H
|
|
|
|
#include <string>
|
|
|
|
#include "store-api.hh"
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
class Pipe;
|
|
class Pid;
|
|
struct FdSink;
|
|
struct FdSource;
|
|
|
|
|
|
class RemoteStore : public StoreAPI
|
|
{
|
|
public:
|
|
|
|
RemoteStore();
|
|
|
|
~RemoteStore();
|
|
|
|
/* Implementations of abstract store API methods. */
|
|
|
|
bool isValidPath(const Path & path);
|
|
|
|
Hash queryPathHash(const Path & path);
|
|
|
|
void queryReferences(const Path & path, PathSet & references);
|
|
|
|
void queryReferrers(const Path & path, PathSet & referrers);
|
|
|
|
Path queryDeriver(const Path & path);
|
|
|
|
PathSet querySubstitutablePaths();
|
|
|
|
bool hasSubstitutes(const Path & path);
|
|
|
|
Path addToStore(const Path & srcPath, bool fixed = false,
|
|
bool recursive = false, string hashAlgo = "",
|
|
PathFilter & filter = defaultPathFilter);
|
|
|
|
Path addTextToStore(const string & suffix, const string & s,
|
|
const PathSet & references);
|
|
|
|
void exportPath(const Path & path, bool sign,
|
|
Sink & sink);
|
|
|
|
Path importPath(bool requireSignature, Source & source);
|
|
|
|
void buildDerivations(const PathSet & drvPaths);
|
|
|
|
void ensurePath(const Path & path);
|
|
|
|
void addTempRoot(const Path & path);
|
|
|
|
void addIndirectRoot(const Path & path);
|
|
|
|
void syncWithGC();
|
|
|
|
Roots findRoots();
|
|
|
|
void collectGarbage(GCAction action, const PathSet & pathsToDelete,
|
|
bool ignoreLiveness, PathSet & result, unsigned long long & bytesFreed);
|
|
|
|
private:
|
|
AutoCloseFD fdSocket;
|
|
FdSink to;
|
|
FdSource from;
|
|
Pid child;
|
|
|
|
void processStderr(Sink * sink = 0, Source * source = 0);
|
|
|
|
void forkSlave();
|
|
|
|
void connectToDaemon();
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif /* !__REMOTE_STORE_H */
|