about summary refs log tree commit diff
path: root/src/libstore/fs-accessor.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-25T16·48+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-25T16·48+0100
commit24a8f9e27bfe63d83cc7ef47c6f133904567d44e (patch)
treeffaf046d18ea435899a87cdb684f26726a554238 /src/libstore/fs-accessor.hh
parentc5bc57186192277b42746bbfba7bb799d9246da3 (diff)
parent1042c10fd0417fe33dd879317f5d7a73aa6f7fe3 (diff)
Merge branch 'master' into new-cli
Diffstat (limited to 'src/libstore/fs-accessor.hh')
-rw-r--r--src/libstore/fs-accessor.hh30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libstore/fs-accessor.hh b/src/libstore/fs-accessor.hh
new file mode 100644
index 000000000000..a67e0775b978
--- /dev/null
+++ b/src/libstore/fs-accessor.hh
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "types.hh"
+
+namespace nix {
+
+/* An abstract class for accessing a filesystem-like structure, such
+   as a (possibly remote) Nix store or the contents of a NAR file. */
+class FSAccessor
+{
+public:
+    enum Type { tMissing, tRegular, tSymlink, tDirectory };
+
+    struct Stat
+    {
+        Type type;
+        uint64_t fileSize; // regular files only
+        bool isExecutable; // regular files only
+    };
+
+    virtual Stat stat(const Path & path) = 0;
+
+    virtual StringSet readDirectory(const Path & path) = 0;
+
+    virtual std::string readFile(const Path & path) = 0;
+
+    virtual std::string readLink(const Path & path) = 0;
+};
+
+}