mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-24 06:56:14 +02:00
1042c10fd0
This is primary to allow hydra-queue-runner to extract files like "nix-support/hydra-build-products" from NARs in binary caches.
30 lines
655 B
C++
30 lines
655 B
C++
#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;
|
|
};
|
|
|
|
}
|