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

Make store implementations pluggable

This for instance allows hydra-queue-runner to add the S3 backend
at runtime.
This commit is contained in:
Eelco Dolstra 2016-02-29 16:11:11 +01:00
parent 6055d84beb
commit 68a5414982
3 changed files with 50 additions and 19 deletions

View file

@ -41,4 +41,13 @@ std::string LocalBinaryCacheStore::getFile(const std::string & path)
return readFile(binaryCacheDir + "/" + path);
}
static RegisterStoreImplementation regStore([](const std::string & uri) -> std::shared_ptr<Store> {
if (std::string(uri, 0, 7) != "file://") return 0;
auto store = std::make_shared<LocalBinaryCacheStore>(std::shared_ptr<Store>(0),
"", "", // FIXME: allow the signing key to be set
std::string(uri, 7));
store->init();
return store;
});
}