diff --git a/lix/libcmd/installable-value.cc b/lix/libcmd/installable-value.cc index 096784a8c..d47f6910c 100644 --- a/lix/libcmd/installable-value.cc +++ b/lix/libcmd/installable-value.cc @@ -8,7 +8,7 @@ std::vector> InstallableValue::getCursors() { auto evalCache = - std::make_shared(std::nullopt, *state, + std::make_shared(std::nullopt, [&]() { return toValue().first; }); return {evalCache->getRoot()}; } diff --git a/lix/libcmd/installables.cc b/lix/libcmd/installables.cc index 02d199ea9..73f85e333 100644 --- a/lix/libcmd/installables.cc +++ b/lix/libcmd/installables.cc @@ -419,7 +419,7 @@ ref openEvalCache( if (fingerprint) { return state.getCacheFor(fingerprint.value(), rootLoader); } else { - return make_ref(std::nullopt, state, rootLoader); + return make_ref(std::nullopt, rootLoader); } } diff --git a/lix/libexpr/eval-cache.cc b/lix/libexpr/eval-cache.cc index 44ed5767d..cdf52723d 100644 --- a/lix/libexpr/eval-cache.cc +++ b/lix/libexpr/eval-cache.cc @@ -21,8 +21,6 @@ struct AttrDb { std::atomic_bool failed{false}; - const Store & cfg; - struct State { SQLite db; @@ -35,11 +33,8 @@ struct AttrDb std::unique_ptr> _state; - AttrDb( - const Store & cfg, - const Hash & fingerprint) - : cfg(cfg) - , _state(std::make_unique>()) + AttrDb(const Hash & fingerprint) + : _state(std::make_unique>()) { auto state(_state->lock()); @@ -317,12 +312,10 @@ struct AttrDb } }; -static std::shared_ptr makeAttrDb( - const Store & cfg, - const Hash & fingerprint) +static std::shared_ptr makeAttrDb(const Hash & fingerprint) { try { - return std::make_shared(cfg, fingerprint); + return std::make_shared(fingerprint); } catch (SQLiteError &) { ignoreExceptionExceptInterrupt(); return nullptr; @@ -334,16 +327,15 @@ ref CachingEvalState::getCacheFor(Hash hash, RootLoader rootLoader) if (auto it = caches.find(hash); it != caches.end()) { return it->second; } - auto cache = make_ref(hash, *this, rootLoader); + auto cache = make_ref(hash, rootLoader); caches.emplace(hash, cache); return cache; } EvalCache::EvalCache( std::optional> useCache, - EvalState & state, RootLoader rootLoader) - : db(useCache ? makeAttrDb(*state.store, *useCache) : nullptr) + : db(useCache ? makeAttrDb(*useCache) : nullptr) , rootLoader(rootLoader) { } diff --git a/lix/libexpr/eval-cache.hh b/lix/libexpr/eval-cache.hh index 124efbb58..6701735d2 100644 --- a/lix/libexpr/eval-cache.hh +++ b/lix/libexpr/eval-cache.hh @@ -49,7 +49,6 @@ public: EvalCache( std::optional> useCache, - EvalState & state, RootLoader rootLoader); ref getRoot();