Commit | Line | Data |
---|---|---|
36457566 LC |
1 | #pragma once |
2 | ||
3 | #include <string> | |
4 | ||
5 | #include "store-api.hh" | |
6 | ||
7 | ||
8 | namespace nix { | |
9 | ||
10 | ||
11 | class Pipe; | |
12 | class Pid; | |
13 | struct FdSink; | |
14 | struct FdSource; | |
15 | ||
16 | ||
17 | class RemoteStore : public StoreAPI | |
18 | { | |
19 | public: | |
20 | ||
21 | RemoteStore(); | |
22 | ||
23 | ~RemoteStore(); | |
54c260e6 | 24 | |
36457566 | 25 | /* Implementations of abstract store API methods. */ |
54c260e6 | 26 | |
36457566 LC |
27 | bool isValidPath(const Path & path); |
28 | ||
29 | PathSet queryValidPaths(const PathSet & paths); | |
54c260e6 | 30 | |
36457566 | 31 | PathSet queryAllValidPaths(); |
54c260e6 | 32 | |
36457566 LC |
33 | ValidPathInfo queryPathInfo(const Path & path); |
34 | ||
35 | Hash queryPathHash(const Path & path); | |
36 | ||
37 | void queryReferences(const Path & path, PathSet & references); | |
38 | ||
39 | void queryReferrers(const Path & path, PathSet & referrers); | |
40 | ||
41 | Path queryDeriver(const Path & path); | |
54c260e6 | 42 | |
36457566 LC |
43 | PathSet queryValidDerivers(const Path & path); |
44 | ||
45 | PathSet queryDerivationOutputs(const Path & path); | |
54c260e6 | 46 | |
36457566 LC |
47 | StringSet queryDerivationOutputNames(const Path & path); |
48 | ||
49 | Path queryPathFromHashPart(const string & hashPart); | |
54c260e6 | 50 | |
36457566 | 51 | PathSet querySubstitutablePaths(const PathSet & paths); |
54c260e6 | 52 | |
36457566 LC |
53 | void querySubstitutablePathInfos(const PathSet & paths, |
54 | SubstitutablePathInfos & infos); | |
54c260e6 LC |
55 | |
56 | Path addToStore(const string & name, const Path & srcPath, | |
36457566 LC |
57 | bool recursive = true, HashType hashAlgo = htSHA256, |
58 | PathFilter & filter = defaultPathFilter, bool repair = false); | |
59 | ||
60 | Path addTextToStore(const string & name, const string & s, | |
61 | const PathSet & references, bool repair = false); | |
62 | ||
63 | void exportPath(const Path & path, bool sign, | |
64 | Sink & sink); | |
65 | ||
66 | Paths importPaths(bool requireSignature, Source & source); | |
54c260e6 | 67 | |
36457566 LC |
68 | void buildPaths(const PathSet & paths, BuildMode buildMode); |
69 | ||
70 | void ensurePath(const Path & path); | |
71 | ||
72 | void addTempRoot(const Path & path); | |
73 | ||
74 | void addIndirectRoot(const Path & path); | |
54c260e6 | 75 | |
36457566 | 76 | void syncWithGC(); |
54c260e6 | 77 | |
36457566 LC |
78 | Roots findRoots(); |
79 | ||
80 | void collectGarbage(const GCOptions & options, GCResults & results); | |
54c260e6 | 81 | |
36457566 LC |
82 | PathSet queryFailedPaths(); |
83 | ||
84 | void clearFailedPaths(const PathSet & paths); | |
2bb04905 LC |
85 | |
86 | void optimiseStore(); | |
87 | ||
54c260e6 | 88 | bool verifyStore(bool checkContents, bool repair); |
36457566 LC |
89 | private: |
90 | AutoCloseFD fdSocket; | |
91 | FdSink to; | |
92 | FdSource from; | |
36457566 LC |
93 | unsigned int daemonVersion; |
94 | bool initialised; | |
95 | ||
96 | void openConnection(bool reserveSpace = true); | |
97 | ||
98 | void processStderr(Sink * sink = 0, Source * source = 0); | |
99 | ||
100 | void connectToDaemon(); | |
101 | ||
102 | void setOptions(); | |
103 | }; | |
104 | ||
105 | ||
106 | } |