diff options
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/local-store.cc | 18 | ||||
-rw-r--r-- | src/libstore/local-store.hh | 3 | ||||
-rw-r--r-- | src/libstore/remote-store.cc | 7 | ||||
-rw-r--r-- | src/libstore/remote-store.hh | 3 | ||||
-rw-r--r-- | src/libstore/store-api.hh | 8 |
5 files changed, 39 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index cace5cb60b36..dcb430a0fcfd 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -696,6 +696,24 @@ Path LocalStore::addTextToStore(const string & suffix, const string & s, } +void LocalStore::exportPath(const Path & path, bool sign, + Sink & sink) +{ + assertStorePath(path); + + dumpPath(path, sink); + + writeString(path, sink); + + PathSet references; + queryReferences(path, references); + writeStringSet(references, sink); + + Path deriver = queryDeriver(noTxn, path); + writeString(deriver, sink); +} + + void deleteFromStore(const Path & _path, unsigned long long & bytesFreed) { bytesFreed = 0; diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 83cb87d451a7..cae9d5c5367f 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -56,6 +56,9 @@ public: Path addTextToStore(const string & suffix, const string & s, const PathSet & references); + void exportPath(const Path & path, bool sign, + Sink & sink); + void buildDerivations(const PathSet & drvPaths); void ensurePath(const Path & path); diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index e6b34c9b8b27..2fb4dd9802f7 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -243,6 +243,13 @@ Path RemoteStore::addTextToStore(const string & suffix, const string & s, } +void RemoteStore::exportPath(const Path & path, bool sign, + Sink & sink) +{ + throw Error("not implemented"); +} + + void RemoteStore::buildDerivations(const PathSet & drvPaths) { writeInt(wopBuildDerivations, to); diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index 42d4e94e2a5b..69fae2cd1601 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -44,6 +44,9 @@ public: Path addTextToStore(const string & suffix, const string & s, const PathSet & references); + void exportPath(const Path & path, bool sign, + Sink & sink); + void buildDerivations(const PathSet & drvPaths); void ensurePath(const Path & path); diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 361e7aaa1aee..6a1de616ca59 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -7,6 +7,7 @@ #include <boost/shared_ptr.hpp> #include "hash.hh" +#include "serialise.hh" namespace nix { @@ -91,6 +92,13 @@ public: virtual Path addTextToStore(const string & suffix, const string & s, const PathSet & references) = 0; + /* 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; + /* Ensure that the output paths of the derivation are valid. If they are already valid, this is a no-op. Otherwise, validity can be reached in two ways. First, if the output paths have |