mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 18:56:16 +02:00
0746951be1
* Finish converting existing comments for internal API docs 99% of this was just reformatting existing comments. Only two exceptions: - Expanded upon `BuildResult::status` compat note - Split up file-level `symbol-table.hh` doc comments to get per-definition docs Also fixed a few whitespace goofs, turning leading tabs to spaces and removing trailing spaces. Picking up from #8133 * Fix two things from comments * Use triple-backtick not indent for `dumpPath` * Convert GNU-style `\`..'` quotes to markdown style in API docs This will render correctly.
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
#pragma once
|
|
///@file
|
|
|
|
#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 = tMissing;
|
|
/**
|
|
* regular files only
|
|
*/
|
|
uint64_t fileSize = 0;
|
|
/**
|
|
* regular files only
|
|
*/
|
|
bool isExecutable = false; // regular files only
|
|
/**
|
|
* regular files only
|
|
*/
|
|
uint64_t narOffset = 0; // regular files only
|
|
};
|
|
|
|
virtual ~FSAccessor() { }
|
|
|
|
virtual Stat stat(const Path & path) = 0;
|
|
|
|
virtual StringSet readDirectory(const Path & path) = 0;
|
|
|
|
/**
|
|
* Read a file inside the store.
|
|
*
|
|
* If `requireValidPath` is set to `true` (the default), the path must be
|
|
* inside a valid store path, otherwise it just needs to be physically
|
|
* present (but not necessarily properly registered)
|
|
*/
|
|
virtual std::string readFile(const Path & path, bool requireValidPath = true) = 0;
|
|
|
|
virtual std::string readLink(const Path & path) = 0;
|
|
};
|
|
|
|
}
|