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:
parent
e0204f8d46
commit
451ebf24ce
18 changed files with 380 additions and 36 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue