N2NKSKHSFR6SDMGZO2ALNDVIOLOEE26BPQHCSWUGEFE3DVVVV4MAC GH4S4AWM2RUS3RUDU4E4TVQJF3N3LKM7OQQSZTG6H7NNMH6FKR7AC W2AOTSS6ZFJZBF3IZKWFXHFW5H4DNGLWCEDJTLMFWVAXL46SNM7QC 73YR46NJNYZQKHA3QDJCAZYAKC2CGEF5LIS44NOIPDZU6FX6BDPQC 24BMQDZAWDQ7VNIA7TIROXSOYLOJBNZ2E4264WHWNJAEN6ZB3UOAC 32HHP5CWAWJB2Q3Q6HYEC66YFGQAV6ESU7VEQ5ENBAQ5ZCRP4KGAC 3FQ65IXOIAWKEV67IXY7WRUX4OGMDYRA3RZJ2XPZ42AZXUANQ74QC MHVIT4JYWUYD4UCGB2AHLXWLX6B5SYE22BREERNGANT7RGGDUFOAC ENXUSMSVOU3AZFMH2ZXR4ZVPV2LRRQYQJ6IFX33YN6IH2ORSNSAAC Path tmp = path + ".tmp." + std::to_string(getpid());AutoDelete del(tmp, false);writeFile(tmp, s);if (rename(tmp.c_str(), path.c_str()))throw SysError(format("renaming ‘%1%’ to ‘%2%’") % tmp % path);del.cancel();
assertStorePath(storePath);return storePathToHash(storePath) + ".narinfo";
#include "local-binary-cache-store.hh"namespace nix {LocalBinaryCacheStore::LocalBinaryCacheStore(ref<Store> localStore,const Path & binaryCacheDir, const Path & secretKeyFile, const Path & publicKeyFile): BinaryCacheStore(localStore, secretKeyFile, publicKeyFile), binaryCacheDir(binaryCacheDir){}void LocalBinaryCacheStore::init(){createDirs(binaryCacheDir + "/nar");BinaryCacheStore::init();}static void atomicWrite(const Path & path, const std::string & s){Path tmp = path + ".tmp." + std::to_string(getpid());AutoDelete del(tmp, false);writeFile(tmp, s);if (rename(tmp.c_str(), path.c_str()))throw SysError(format("renaming ‘%1%’ to ‘%2%’") % tmp % path);del.cancel();}bool LocalBinaryCacheStore::fileExists(const std::string & path){return pathExists(binaryCacheDir + "/" + path);}void LocalBinaryCacheStore::upsertFile(const std::string & path, const std::string & data){atomicWrite(binaryCacheDir + "/" + path, data);}std::string LocalBinaryCacheStore::getFile(const std::string & path){return readFile(binaryCacheDir + "/" + path);}}
#pragma once#include "binary-cache-store.hh"namespace nix {class LocalBinaryCacheStore : public BinaryCacheStore{private:Path binaryCacheDir;public:LocalBinaryCacheStore(ref<Store> localStore, const Path & binaryCacheDir,const Path & secretKeyFile, const Path & publicKeyFile);void init() override;protected:bool fileExists(const std::string & path) override;void upsertFile(const std::string & path, const std::string & data) override;std::string getFile(const std::string & path) override;};}