about summary refs log tree commit diff
path: root/src/libstore/remote-fs-accessor.hh
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-09-02T18·24-0400
committerShea Levy <shea@shealevy.com>2016-09-02T18·24-0400
commita705e8ce0a8aaf3afe885892834468e95c197a16 (patch)
tree69703f6498c8e5047f90f1dcc26cdb3ae45c6e29 /src/libstore/remote-fs-accessor.hh
parent0f3963329018d9cf930e2a0e2b0ec2f4e26b40b3 (diff)
Factor a general remote FS accessor out of BinaryCacheStore
Diffstat (limited to 'src/libstore/remote-fs-accessor.hh')
-rw-r--r--src/libstore/remote-fs-accessor.hh29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/libstore/remote-fs-accessor.hh b/src/libstore/remote-fs-accessor.hh
new file mode 100644
index 000000000000..28f36c8296e1
--- /dev/null
+++ b/src/libstore/remote-fs-accessor.hh
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "fs-accessor.hh"
+#include "ref.hh"
+#include "store-api.hh"
+
+namespace nix {
+
+class RemoteFSAccessor : public FSAccessor
+{
+    ref<Store> store;
+
+    std::map<Path, ref<FSAccessor>> nars;
+
+    std::pair<ref<FSAccessor>, Path> fetch(const Path & path_);
+public:
+
+    RemoteFSAccessor(ref<Store> store);
+
+    Stat stat(const Path & path) override;
+
+    StringSet readDirectory(const Path & path) override;
+
+    std::string readFile(const Path & path) override;
+
+    std::string readLink(const Path & path) override;
+};
+
+}