Make store implementations pluggable
This for instance allows hydra-queue-runner to add the S3 backend at runtime.
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user