Pool local store connections

This commit is contained in:
Eelco Dolstra
2016-02-20 00:04:08 +01:00
parent 1cefd6cac8
commit 88a05763cc
6 changed files with 38 additions and 17 deletions

View File

@ -18,6 +18,7 @@ using namespace nix;
State::State()
: localStorePool([]() { return std::make_shared<ref<Store>>(openStore()); })
{
hydraData = getEnv("HYDRA_DATA");
if (hydraData == "") throw Error("$HYDRA_DATA must be set");
@ -26,9 +27,10 @@ State::State()
}
ref<Store> State::getLocalStore()
StorePool::Handle State::getLocalStore()
{
return openStore(); // FIXME: pool
auto conn(localStorePool.get());
return conn;
}
@ -733,10 +735,10 @@ void State::run(BuildID buildOne)
#endif
auto store = std::make_shared<S3BinaryCacheStore>(
[]() { return openStore(); },
"/home/eelco/Misc/Keys/test.nixos.org/secret",
"/home/eelco/Misc/Keys/test.nixos.org/public",
"nix-test-cache-3");;
[this]() { return this->getLocalStore(); },
"/home/eelco/hydra/secret",
"/home/eelco/hydra/public",
"nix-test-cache");
store->init();
_destStore = store;