diff --git a/lix/libstore/binary-cache-store.cc b/lix/libstore/binary-cache-store.cc index 470a24218..1a67ec27e 100644 --- a/lix/libstore/binary-cache-store.cc +++ b/lix/libstore/binary-cache-store.cc @@ -505,21 +505,6 @@ try { co_return result::current_exception(); } -kj::Promise>> -BinaryCacheStore::queryRealisationUncached(const DrvOutput & id) -try { - auto outputInfoFilePath = realisationsPrefix + "/" + id.to_string() + ".doi"; - - auto data = getFileContents(outputInfoFilePath); - if (!data) co_return result::success(nullptr); - - auto realisation = Realisation::fromJSON( - json::parse(*data), outputInfoFilePath); - co_return std::make_shared(realisation); -} catch (...) { - co_return result::current_exception(); -} - ref BinaryCacheStore::getFSAccessor() { return make_ref(ref(*this), config().localNarCache); diff --git a/lix/libstore/binary-cache-store.hh b/lix/libstore/binary-cache-store.hh index 68ca3f3e5..db7424434 100644 --- a/lix/libstore/binary-cache-store.hh +++ b/lix/libstore/binary-cache-store.hh @@ -146,9 +146,6 @@ public: const StorePathSet & references, RepairFlag repair) override; - kj::Promise>> - queryRealisationUncached(const DrvOutput &) override; - kj::Promise>> narFromPath(const StorePath & path) override; ref getFSAccessor() override; diff --git a/lix/libstore/daemon.cc b/lix/libstore/daemon.cc index f591b3a74..5f8c2b322 100644 --- a/lix/libstore/daemon.cc +++ b/lix/libstore/daemon.cc @@ -946,25 +946,9 @@ static void performOp(AsyncIoRoot & aio, TunnelLogger * logger, ref store break; } - case WorkerProto::Op::RegisterDrvOutput: { - throw UnimplementedError("ca derivations are not supported"); - } - + case WorkerProto::Op::RegisterDrvOutput: case WorkerProto::Op::QueryRealisation: { - logger->startWork(); - auto outputId = DrvOutput::parse(readString(from)); - auto info = aio.blockOn(store->queryRealisation(outputId)); - logger->stopWork(); - if (GET_PROTOCOL_MINOR(clientVersion) < 31) { - std::set outPaths; - if (info) outPaths.insert(info->outPath); - to << WorkerProto::write(*store, wconn, outPaths); - } else { - std::set realisations; - if (info) realisations.insert(*info); - to << WorkerProto::write(*store, wconn, realisations); - } - break; + throw UnimplementedError("ca derivations are not supported"); } case WorkerProto::Op::AddBuildLog: { diff --git a/lix/libstore/dummy-store.cc b/lix/libstore/dummy-store.cc index ea8d0d33a..84c56f298 100644 --- a/lix/libstore/dummy-store.cc +++ b/lix/libstore/dummy-store.cc @@ -74,10 +74,6 @@ struct DummyStore final : public Store kj::Promise>> narFromPath(const StorePath & path) override try { unsupported("narFromPath"); } catch (...) { return {result::current_exception()}; } - kj::Promise>> - queryRealisationUncached(const DrvOutput &) override - { co_return result::success(nullptr); } - virtual ref getFSAccessor() override { unsupported("getFSAccessor"); } }; diff --git a/lix/libstore/legacy-ssh-store.cc b/lix/libstore/legacy-ssh-store.cc index 9e9ed2442..63a237407 100644 --- a/lix/libstore/legacy-ssh-store.cc +++ b/lix/libstore/legacy-ssh-store.cc @@ -463,11 +463,6 @@ public: { return {result::success(std::nullopt)}; } - - kj::Promise>> - queryRealisationUncached(const DrvOutput &) override - // TODO: Implement - try { unsupported("queryRealisation"); } catch (...) { co_return result::current_exception(); } }; void registerLegacySSHStore() { diff --git a/lix/libstore/local-store.cc b/lix/libstore/local-store.cc index 2c5d3d0ed..96b59c22f 100644 --- a/lix/libstore/local-store.cc +++ b/lix/libstore/local-store.cc @@ -1841,81 +1841,6 @@ void LocalStore::signPathInfo(ValidPathInfo & info) } -std::optional> LocalStore::queryRealisationCore_( - LocalStore::DBState & state, - const DrvOutput & id) -{ - auto useQueryRealisedOutput( - state.stmts->QueryRealisedOutput.use() - (id.strHash()) - (id.outputName)); - if (!useQueryRealisedOutput.next()) - return std::nullopt; - auto realisationDbId = useQueryRealisedOutput.getInt(0); - auto outputPath = parseStorePath(useQueryRealisedOutput.getStr(1)); - auto signatures = - tokenizeString(useQueryRealisedOutput.getStr(2)); - - return {{ - realisationDbId, - Realisation{ - .id = id, - .outPath = outputPath, - .signatures = signatures, - } - }}; -} - -std::optional LocalStore::queryRealisation_( - LocalStore::DBState & state, - const DrvOutput & id) -{ - auto maybeCore = queryRealisationCore_(state, id); - if (!maybeCore) - return std::nullopt; - auto [realisationDbId, res] = *maybeCore; - - std::map dependentRealisations; - auto useRealisationRefs( - state.stmts->QueryRealisationReferences.use() - (realisationDbId)); - while (useRealisationRefs.next()) { - auto depId = DrvOutput { - Hash::parseAnyPrefixed(useRealisationRefs.getStr(0)), - useRealisationRefs.getStr(1), - }; - auto dependentRealisation = queryRealisationCore_(state, depId); - assert(dependentRealisation); // Enforced by the db schema - auto outputPath = dependentRealisation->second.outPath; - dependentRealisations.insert({depId, outputPath}); - } - - res.dependentRealisations = dependentRealisations; - - return { res }; -} - -kj::Promise>> -LocalStore::queryRealisationUncached(const DrvOutput & id) -try { - auto maybeRealisation = - // NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines) - TRY_AWAIT(retrySQLite([&]() -> kj::Promise>> { - try { - auto state = co_await _dbState.lock(); - co_return queryRealisation_(*state, id); - } catch (...) { - co_return result::current_exception(); - } - })); - if (maybeRealisation) - co_return std::make_shared(maybeRealisation.value()); - else - co_return result::success(nullptr); -} catch (...) { - co_return result::current_exception(); -} - ContentAddress LocalStore::hashCAPath( const ContentAddressMethod & method, const HashType & hashType, const StorePath & path) diff --git a/lix/libstore/local-store.hh b/lix/libstore/local-store.hh index b26f6ad49..07bf7e7d6 100644 --- a/lix/libstore/local-store.hh +++ b/lix/libstore/local-store.hh @@ -325,11 +325,6 @@ public: const std::string & outputName, const StorePath & output); - std::optional queryRealisation_(DBState & state, const DrvOutput & id); - std::optional> queryRealisationCore_(DBState & state, const DrvOutput & id); - kj::Promise>> - queryRealisationUncached(const DrvOutput&) override; - kj::Promise>> getVersion() override; private: diff --git a/lix/libstore/realisation.cc b/lix/libstore/realisation.cc index 932653a81..0592bb89d 100644 --- a/lix/libstore/realisation.cc +++ b/lix/libstore/realisation.cc @@ -24,43 +24,6 @@ std::string DrvOutput::to_string() const { return strHash() + "!" + outputName; } -kj::Promise>> -Realisation::closure(Store & store, const std::set & startOutputs) -try { - std::set res; - TRY_AWAIT(Realisation::closure(store, startOutputs, res)); - co_return res; -} catch (...) { - co_return result::current_exception(); -} - -kj::Promise> Realisation::closure( - Store & store, const std::set & startOutputs, std::set & res -) -try { - // NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines) - auto getDeps = [&](const Realisation& current) -> kj::Promise>> { - try { - std::set res; - for (auto& [currentDep, _] : current.dependentRealisations) { - if (auto currentRealisation = TRY_AWAIT(store.queryRealisation(currentDep))) - res.insert(*currentRealisation); - else - throw Error( - "Unrealised derivation '%s'", currentDep.to_string()); - } - co_return res; - } catch (...) { - co_return result::current_exception(); - } - }; - - res.merge(TRY_AWAIT(computeClosureAsync(startOutputs, getDeps))); - co_return result::success(); -} catch (...) { - co_return result::current_exception(); -} - JSON Realisation::toJSON() const { auto jsonDependentRealisations = JSON::object(); for (auto & [depId, depOutPath] : dependentRealisations) diff --git a/lix/libstore/realisation.hh b/lix/libstore/realisation.hh index 452cb7fb3..17c9008ca 100644 --- a/lix/libstore/realisation.hh +++ b/lix/libstore/realisation.hh @@ -68,11 +68,6 @@ struct Realisation { bool checkSignature(const PublicKeys & publicKeys, const std::string & sig) const; size_t checkSignatures(const PublicKeys & publicKeys) const; - static kj::Promise>> - closure(Store &, const std::set &); - static kj::Promise> - closure(Store &, const std::set &, std::set & res); - bool isCompatibleWith(const Realisation & other) const; StorePath getPath() const { return outPath; } diff --git a/lix/libstore/remote-store.cc b/lix/libstore/remote-store.cc index 4daf270ba..9090b8626 100644 --- a/lix/libstore/remote-store.cc +++ b/lix/libstore/remote-store.cc @@ -603,39 +603,6 @@ try { co_return result::current_exception(); } -kj::Promise>> -RemoteStore::queryRealisationUncached(const DrvOutput & id) -try { - auto conn(TRY_AWAIT(getConnection())); - - if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 27) { - warn("the daemon is too old to support content-addressed derivations, please upgrade it to 2.4"); - co_return result::success(nullptr); - } - - conn->to << WorkerProto::Op::QueryRealisation; - conn->to << id.to_string(); - conn.processStderr(); - - if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 31) { - auto outPaths = WorkerProto::Serialise>::read( - *this, *conn); - if (outPaths.empty()) - co_return result::success(nullptr); - co_return std::make_shared( - Realisation{.id = id, .outPath = *outPaths.begin()} - ); - } else { - auto realisations = WorkerProto::Serialise>::read( - *this, *conn); - if (realisations.empty()) - co_return result::success(nullptr); - co_return std::make_shared(*realisations.begin()); - } -} catch (...) { - co_return result::current_exception(); -} - kj::Promise> RemoteStore::copyDrvsFromEvalStore( const std::vector & paths, std::shared_ptr evalStore) diff --git a/lix/libstore/remote-store.hh b/lix/libstore/remote-store.hh index aaaaf3555..99eb96f02 100644 --- a/lix/libstore/remote-store.hh +++ b/lix/libstore/remote-store.hh @@ -117,9 +117,6 @@ public: const StorePathSet & references, RepairFlag repair) override; - kj::Promise>> - queryRealisationUncached(const DrvOutput &) override; - kj ::Promise> buildPaths( const std::vector & paths, BuildMode buildMode, diff --git a/lix/libstore/store-api.cc b/lix/libstore/store-api.cc index e882ca366..354124974 100644 --- a/lix/libstore/store-api.cc +++ b/lix/libstore/store-api.cc @@ -733,40 +733,6 @@ try { co_return result::current_exception(); } -kj::Promise>> Store::queryRealisation(const DrvOutput & id) -try { - - if (diskCache) { - auto [cacheOutcome, maybeCachedRealisation] - = diskCache->lookupRealisation(getUri(), id); - switch (cacheOutcome) { - case NarInfoDiskCache::oValid: - debug("Returning a cached realisation for %s", id.to_string()); - co_return maybeCachedRealisation; - case NarInfoDiskCache::oInvalid: - debug( - "Returning a cached missing realisation for %s", - id.to_string()); - co_return result::success(nullptr); - case NarInfoDiskCache::oUnknown: - break; - } - } - - auto info = TRY_AWAIT(queryRealisationUncached(id)); - - if (diskCache) { - if (info) - diskCache->upsertRealisation(getUri(), *info); - else - diskCache->upsertAbsentRealisation(getUri(), id); - } - - co_return info; -} catch (...) { - co_return result::current_exception(); -} - kj::Promise> Store::substitutePaths(const StorePathSet & paths) try { std::vector paths2; diff --git a/lix/libstore/store-api.hh b/lix/libstore/store-api.hh index ccb30a531..39ee68d7f 100644 --- a/lix/libstore/store-api.hh +++ b/lix/libstore/store-api.hh @@ -392,11 +392,6 @@ public: */ kj::Promise>> queryPathInfo(const StorePath & path); - /** - * Query the information about a realisation. - */ - kj::Promise>> queryRealisation(const DrvOutput &); - /** * Check whether the given valid path info is sufficiently attested, by @@ -427,8 +422,6 @@ protected: */ virtual kj::Promise>> queryPathInfoUncached(const StorePath & path) = 0; - virtual kj::Promise>> - queryRealisationUncached(const DrvOutput &) = 0; public: diff --git a/perl/lib/Nix/Store.pm b/perl/lib/Nix/Store.pm index 3e4bbee0a..179f1dc90 100644 --- a/perl/lib/Nix/Store.pm +++ b/perl/lib/Nix/Store.pm @@ -22,7 +22,6 @@ our @EXPORT = qw( derivationFromPath addTempRoot getBinDir getStoreDir - queryRawRealisation ); our $VERSION = '0.15'; diff --git a/perl/lib/Nix/Store.xs b/perl/lib/Nix/Store.xs index 3d0d060f7..64899e341 100644 --- a/perl/lib/Nix/Store.xs +++ b/perl/lib/Nix/Store.xs @@ -131,18 +131,6 @@ SV * queryPathInfo(char * path, int base32) croak("%s", e.what()); } -SV * queryRawRealisation(char * outputId) - PPCODE: - try { - auto realisation = aio().blockOn(store()->queryRealisation(DrvOutput::parse(outputId))); - if (realisation) - XPUSHs(sv_2mortal(newSVpv(realisation->toJSON().dump().c_str(), 0))); - else - XPUSHs(sv_2mortal(newSVpv("", 0))); - } catch (Error & e) { - croak("%s", e.what()); - } - SV * queryPathFromHashPart(char * hashPart) PPCODE: