6#include <unordered_set>
8#include <boost/unordered/concurrent_flat_map_fwd.hpp>
17typedef fun<RestrictedPathError(
const CanonPath & path)> MakeNotAllowedError;
24struct FilteringSourceAccessor : SourceAccessor
27 void anchor()
override;
32 MakeNotAllowedError makeNotAllowedError;
34 FilteringSourceAccessor(
const SourcePath & src, MakeNotAllowedError && makeNotAllowedError)
37 , makeNotAllowedError(std::move(makeNotAllowedError))
39 displayPrefix.clear();
52 std::optional<Stat> maybeLstat(
const CanonPath & path)
override;
56 std::string readLink(
const CanonPath & path)
override;
64 next->invalidateCache();
86 void anchor()
override;
96 const std::set<CanonPath> & allowedPrefixes,
97 const std::unordered_set<CanonPath> & allowedPaths,
98 MakeNotAllowedError && makeNotAllowedError);
100 using FilteringSourceAccessor::FilteringSourceAccessor;
106struct CachingFilteringSourceAccessor : FilteringSourceAccessor
109 void anchor()
override;
114 CachingFilteringSourceAccessor(
const SourcePath & src, MakeNotAllowedError && makeNotAllowedError);
118 virtual bool isAllowedUncached(
const CanonPath & path) = 0;
Definition canon-path.hh:50
Definition filtering-source-accessor.hh:84
virtual void allowPrefix(CanonPath prefix)=0
bool isAllowed(const CanonPath &path) override
Definition filtering-source-accessor.cc:129
bool pathExists(const CanonPath &path) override
Check whether a file exists at path.
Definition filtering-source-accessor.cc:28
std::string showPath(const CanonPath &path) override
Render a human-readable representation of the accessor + path beneath it.
Definition filtering-source-accessor.cc:61
virtual bool isAllowed(const CanonPath &path)=0
std::optional< std::filesystem::path > getPhysicalPath(const CanonPath &path) override
Definition filtering-source-accessor.cc:16
void invalidateCache() override
Definition filtering-source-accessor.hh:62
DirEntries readDirectory(const CanonPath &path) override
Definition filtering-source-accessor.cc:44
std::pair< CanonPath, std::optional< std::string > > getFingerprint(const CanonPath &path) override
Definition filtering-source-accessor.cc:66
void readFile(const CanonPath &path, Sink &sink, fun< void(uint64_t)> sizeCallback) override
Definition filtering-source-accessor.cc:22
void checkAccess(const CanonPath &path)
Definition filtering-source-accessor.cc:73
Definition serialise.hh:18
Definition source-accessor.hh:119
std::string readFile(const CanonPath &path)
Definition source-accessor.cc:62
Definition source-path.hh:22