diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc index 116593d0f..848669ae8 100644 --- a/src/libstore/binary-cache-store.cc +++ b/src/libstore/binary-cache-store.cc @@ -127,8 +127,7 @@ void BinaryCacheStore::writeNarInfo(ref narInfo) upsertFile(narInfoFile, narInfo->to_string(*this), "text/x-nix-narinfo"); - pathInfoCache->lock()->upsert( - std::string(narInfo->path.to_string()), PathInfoCacheValue{.value = std::shared_ptr(narInfo)}); + pathInfoCache->lock()->upsert(narInfo->path, PathInfoCacheValue{.value = std::shared_ptr(narInfo)}); if (diskCache) diskCache->upsertNarInfo( diff --git a/src/libstore/include/nix/store/store-api.hh b/src/libstore/include/nix/store/store-api.hh index 9535227eb..db107fc0c 100644 --- a/src/libstore/include/nix/store/store-api.hh +++ b/src/libstore/include/nix/store/store-api.hh @@ -310,7 +310,7 @@ protected: // Note: this is a `ref` to avoid false sharing with immutable // bits of `Store`. - ref>> pathInfoCache; + ref>> pathInfoCache; std::shared_ptr diskCache; diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index aa340dfb9..51392f014 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -722,8 +722,7 @@ uint64_t LocalStore::addValidPath(State & state, const ValidPathInfo & info, boo } } - pathInfoCache->lock()->upsert( - std::string(info.path.to_string()), PathInfoCacheValue{.value = std::make_shared(info)}); + pathInfoCache->lock()->upsert(info.path, PathInfoCacheValue{.value = std::make_shared(info)}); return id; } @@ -1021,7 +1020,7 @@ void LocalStore::invalidatePath(State & state, const StorePath & path) /* Note that the foreign key constraints on the Refs table take care of deleting the references entries for `path'. */ - pathInfoCache->lock()->erase(std::string(path.to_string())); + pathInfoCache->lock()->erase(path); } const PublicKeys & LocalStore::getPublicKeys() diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 52130668c..921507add 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -343,7 +343,7 @@ bool Store::PathInfoCacheValue::isKnownNow() void Store::invalidatePathInfoCacheFor(const StorePath & path) { - pathInfoCache->lock()->erase(path.to_string()); + pathInfoCache->lock()->erase(path); } std::map> Store::queryStaticPartialDerivationOutputMap(const StorePath & path) @@ -471,7 +471,7 @@ void Store::querySubstitutablePathInfos(const StorePathCAMap & paths, Substituta bool Store::isValidPath(const StorePath & storePath) { - auto res = pathInfoCache->lock()->get(storePath.to_string()); + auto res = pathInfoCache->lock()->get(storePath); if (res && res->isKnownNow()) { stats.narInfoReadAverted++; return res->didExist(); @@ -483,7 +483,7 @@ bool Store::isValidPath(const StorePath & storePath) if (res.first != NarInfoDiskCache::oUnknown) { stats.narInfoReadAverted++; pathInfoCache->lock()->upsert( - storePath.to_string(), + storePath, res.first == NarInfoDiskCache::oInvalid ? PathInfoCacheValue{} : PathInfoCacheValue{.value = res.second}); return res.first == NarInfoDiskCache::oValid; @@ -537,7 +537,7 @@ std::optional> Store::queryPathInfoFromClie { auto hashPart = std::string(storePath.hashPart()); - auto res = pathInfoCache->lock()->get(storePath.to_string()); + auto res = pathInfoCache->lock()->get(storePath); if (res && res->isKnownNow()) { stats.narInfoReadAverted++; if (res->didExist()) @@ -551,7 +551,7 @@ std::optional> Store::queryPathInfoFromClie if (res.first != NarInfoDiskCache::oUnknown) { stats.narInfoReadAverted++; pathInfoCache->lock()->upsert( - storePath.to_string(), + storePath, res.first == NarInfoDiskCache::oInvalid ? PathInfoCacheValue{} : PathInfoCacheValue{.value = res.second}); if (res.first == NarInfoDiskCache::oInvalid || !goodStorePath(storePath, res.second->path)) @@ -591,7 +591,7 @@ void Store::queryPathInfo(const StorePath & storePath, CallbackupsertNarInfo(config.getReference().render(/*FIXME withParams=*/false), hashPart, info); - pathInfoCache->lock()->upsert(storePath.to_string(), PathInfoCacheValue{.value = info}); + pathInfoCache->lock()->upsert(storePath, PathInfoCacheValue{.value = info}); if (!info || !goodStorePath(storePath, info->path)) { stats.narInfoMissing++;