1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 15:51:15 +02:00

Store the realisations as JSON in the binary cache

Fix #4332
This commit is contained in:
regnat 2020-12-08 21:07:52 +01:00 committed by Théophane Hufschmitt
parent 3ac9d74eb1
commit 8914e01e37
3 changed files with 25 additions and 46 deletions

View file

@ -449,7 +449,8 @@ std::optional<const Realisation> BinaryCacheStore::queryRealisation(const DrvOut
auto rawOutputInfo = getFile(outputInfoFilePath);
if (rawOutputInfo) {
return { Realisation::parse(*rawOutputInfo, outputInfoFilePath) };
return {Realisation::fromJSON(
nlohmann::json::parse(*rawOutputInfo), outputInfoFilePath)};
} else {
return std::nullopt;
}
@ -457,7 +458,7 @@ std::optional<const Realisation> BinaryCacheStore::queryRealisation(const DrvOut
void BinaryCacheStore::registerDrvOutput(const Realisation& info) {
auto filePath = realisationsPrefix + "/" + info.id.to_string() + ".doi";
upsertFile(filePath, info.to_string(), "text/x-nix-derivertopath");
upsertFile(filePath, info.toJSON(), "application/json");
}
ref<FSAccessor> BinaryCacheStore::getFSAccessor()