1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-04 08:00:59 +01:00

Merge InputAccessor into SourceAccessor

After the removal of the InputAccessor::fetchToStore() method, the
only remaining functionality in InputAccessor was `fingerprint` and
`getLastModified()`, and there is no reason to keep those in a
separate class.
This commit is contained in:
Eelco Dolstra 2024-05-03 12:14:01 +02:00
parent 00ca2b05b8
commit ba5929c7be
35 changed files with 130 additions and 188 deletions

View file

@ -2,11 +2,11 @@
namespace nix {
struct MountedInputAccessor : InputAccessor
struct MountedInputAccessor : SourceAccessor
{
std::map<CanonPath, ref<InputAccessor>> mounts;
std::map<CanonPath, ref<SourceAccessor>> mounts;
MountedInputAccessor(std::map<CanonPath, ref<InputAccessor>> _mounts)
MountedInputAccessor(std::map<CanonPath, ref<SourceAccessor>> _mounts)
: mounts(std::move(_mounts))
{
displayPrefix.clear();
@ -53,7 +53,7 @@ struct MountedInputAccessor : InputAccessor
return displayPrefix + accessor->showPath(subpath) + displaySuffix;
}
std::pair<ref<InputAccessor>, CanonPath> resolve(CanonPath path)
std::pair<ref<SourceAccessor>, CanonPath> resolve(CanonPath path)
{
// Find the nearest parent of `path` that is a mount point.
std::vector<std::string> subpath;
@ -71,7 +71,7 @@ struct MountedInputAccessor : InputAccessor
}
};
ref<InputAccessor> makeMountedInputAccessor(std::map<CanonPath, ref<InputAccessor>> mounts)
ref<SourceAccessor> makeMountedInputAccessor(std::map<CanonPath, ref<SourceAccessor>> mounts)
{
return make_ref<MountedInputAccessor>(std::move(mounts));
}