1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

Deduplicate FSSourceAccessor and FSInputAccessor

This commit is contained in:
Eelco Dolstra 2023-10-19 15:20:10 +02:00
parent 9f572eb0e3
commit 50156302c0
4 changed files with 82 additions and 74 deletions

View file

@ -93,4 +93,28 @@ struct SourceAccessor
}
};
/**
* A source accessor that uses the Unix filesystem.
*/
struct PosixSourceAccessor : SourceAccessor
{
/**
* The most recent mtime seen by lstat(). This is a hack to
* support dumpPathAndGetMtime(). Should remove this eventually.
*/
time_t mtime = 0;
std::string readFile(const CanonPath & path) override;
bool pathExists(const CanonPath & path) override;
Stat lstat(const CanonPath & path) override;
DirEntries readDirectory(const CanonPath & path) override;
std::string readLink(const CanonPath & path) override;
std::optional<CanonPath> getPhysicalPath(const CanonPath & path) override;
};
}