Store the realisations as JSON in the binary cache

Fix #4332
This commit is contained in:
regnat
2020-12-11 21:05:09 +01:00
committed by Théophane Hufschmitt
parent 3ac9d74eb1
commit 8914e01e37
3 changed files with 25 additions and 46 deletions
+3 -2
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()