Inline RemoteFSAccessor::makeCacheFile into lambda

It's just easier to avoid headers.
This commit is contained in:
John Ericson committed 2026-01-13 01:33:53 -05:00
1 parent 7ac5a61208
commit 8f829e478f
2 files changed
+9 -13

No files matched your search

@@ -31,8 +31,6 @@ class RemoteFSAccessor : public SourceAccessor
friend struct BinaryCacheStore;
std::filesystem::path makeCacheFile(const Hash & narHash, const std::string & ext);
public:
/**
+9 -11
View File
@@ -18,15 +18,6 @@ RemoteFSAccessor::RemoteFSAccessor(
createDirs(*cacheDir);
}
std::filesystem::path RemoteFSAccessor::makeCacheFile(const Hash & narHash, const std::string & ext)
{
assert(cacheDir);
auto res = *cacheDir / narHash.to_string(HashFormat::Nix32, false);
res += ".";
res += ext;
return res;
}
std::pair<ref<SourceAccessor>, CanonPath> RemoteFSAccessor::fetch(const CanonPath & path)
{
auto [storePath, restPath] = store->toStorePath(store->storeDir + path.abs());
@@ -57,8 +48,15 @@ std::shared_ptr<SourceAccessor> RemoteFSAccessor::accessObject(const StorePath &
};
if (cacheDir) {
auto cacheFile = makeCacheFile(info->narHash, "nar");
auto listingFile = makeCacheFile(info->narHash, "ls");
auto makeCacheFile = [&](const std::string & ext) {
auto res = *cacheDir / info->narHash.to_string(HashFormat::Nix32, false);
res += ".";
res += ext;
return res;
};
auto cacheFile = makeCacheFile("nar");
auto listingFile = makeCacheFile("ls");
if (nix::pathExists(cacheFile)) {
try {