about summary refs log tree commit diff
path: root/src/libstore/store-api.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-04T11·36+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-04T14·15+0200
commit538a64e8c314f23ba0c5d76201f1c20e71884a21 (patch)
tree34bdfda7346d53014619cbfa33bf1398bad4b5e2 /src/libstore/store-api.hh
parentb6c768fb6a341bf1c5fe4a2d2a929415e8519b25 (diff)
Add a Store::addToStore() variant that accepts a NAR
As a side effect, this ensures that signatures are propagated when
copying paths between stores.

Also refactored import/export to make use of this.
Diffstat (limited to 'src/libstore/store-api.hh')
-rw-r--r--src/libstore/store-api.hh34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 95ad5136d965..f680e951f895 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -19,7 +19,7 @@ namespace nix {
 /* Size of the hash part of store paths, in base-32 characters. */
 const size_t storePathHashLen = 32; // i.e. 160 bits
 
-/* Magic header of exportPath() output. */
+/* Magic header of exportPath() output (obsolete). */
 const uint32_t exportMagic = 0x4558494e;
 
 
@@ -253,6 +253,10 @@ public:
     virtual void querySubstitutablePathInfos(const PathSet & paths,
         SubstitutablePathInfos & infos) = 0;
 
+    /* Import a path into the store. */
+    virtual void addToStore(const ValidPathInfo & info, const std::string & nar,
+        bool repair = false) = 0;
+
     /* Copy the contents of a path to the store and register the
        validity the resulting path.  The resulting path is returned.
        The function object `filter' can be used to exclude files (see
@@ -269,21 +273,6 @@ public:
     /* Write a NAR dump of a store path. */
     virtual void narFromPath(const Path & path, Sink & sink) = 0;
 
-    /* Export a store path, that is, create a NAR dump of the store
-       path and append its references and its deriver. */
-    virtual void exportPath(const Path & path, Sink & sink) = 0;
-
-    /* Export multiple paths in the format expected by ‘nix-store
-       --import’. */
-    void exportPaths(const Paths & paths, Sink & sink);
-
-    /* Import a sequence of NAR dumps created by exportPaths() into
-       the Nix store. Optionally, the contents of the NARs are
-       preloaded into the specified FS accessor to speed up subsequent
-       access. */
-    virtual Paths importPaths(Source & source,
-        std::shared_ptr<FSAccessor> accessor) = 0;
-
     /* For each path, if it's a derivation, build it.  Building a
        derivation means ensuring that the output paths are valid.  If
        they are already valid, this is a no-op.  Otherwise, validity
@@ -397,6 +386,19 @@ public:
        relation.  If p refers to q, then p preceeds q in this list. */
     Paths topoSortPaths(const PathSet & paths);
 
+    /* Export multiple paths in the format expected by ‘nix-store
+       --import’. */
+    void exportPaths(const Paths & paths, Sink & sink);
+
+    void exportPath(const Path & path, Sink & sink);
+
+    /* Import a sequence of NAR dumps created by exportPaths() into
+       the Nix store. Optionally, the contents of the NARs are
+       preloaded into the specified FS accessor to speed up subsequent
+       access. */
+    Paths importPaths(Source & source,
+        std::shared_ptr<FSAccessor> accessor);
+
     struct Stats
     {
         std::atomic<uint64_t> narInfoRead{0};