1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

Cache path info lookups in SQLite

This re-implements the binary cache database in C++, allowing it to be
used by other Store backends, in particular the S3 backend.
This commit is contained in:
Eelco Dolstra 2016-04-20 14:12:38 +02:00
parent e0204f8d46
commit 451ebf24ce
18 changed files with 380 additions and 36 deletions

View file

@ -1,6 +1,7 @@
#include "binary-cache-store.hh"
#include "download.hh"
#include "globals.hh"
#include "nar-info-disk-cache.hh"
namespace nix {
@ -24,13 +25,23 @@ public:
{
if (cacheUri.back() == '/')
cacheUri.pop_back();
diskCache = getNarInfoDiskCache();
}
std::string getUri() override
{
return cacheUri;
}
void init() override
{
// FIXME: do this lazily?
if (!fileExists("nix-cache-info"))
throw Error(format("%s does not appear to be a binary cache") % cacheUri);
if (!diskCache->cacheExists(cacheUri)) {
if (!fileExists("nix-cache-info"))
throw Error(format("%s does not appear to be a binary cache") % cacheUri);
diskCache->createCache(cacheUri);
}
}
protected: