From a73f211bf2a1068e99bcf9965b85616c34d57995 Mon Sep 17 00:00:00 2001 From: Alexander Ried Date: Thu, 12 May 2016 10:15:15 +0200 Subject: [PATCH] Use store-api for binary cache instantiation --- src/hydra-queue-runner/hydra-queue-runner.cc | 30 +++----------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index fe1d1008..546bd40f 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -7,7 +7,7 @@ #include "state.hh" #include "build-result.hh" -#include "s3-binary-cache-store.hh" +#include "store-api.hh" #include "shared.hh" #include "globals.hh" @@ -794,34 +794,12 @@ void State::run(BuildID buildOne) if (!lock) throw Error("hydra-queue-runner is already running"); - auto storeMode = hydraConfig["store_mode"]; - _localStore = openStore(); - if (storeMode == "direct" || storeMode == "") { + if (hydraConfig["store_uri"] == "") { _destStore = _localStore; - } - - else if (storeMode == "local-binary-cache") { - auto dir = hydraConfig["binary_cache_dir"]; - if (dir == "") - throw Error("you must set ‘binary_cache_dir’ in hydra.conf"); - _destStore = openLocalBinaryCacheStore( - _localStore, - hydraConfig["binary_cache_secret_key_file"], - dir); - } - - else if (storeMode == "s3-binary-cache") { - auto bucketName = hydraConfig["binary_cache_s3_bucket"]; - if (bucketName == "") - throw Error("you must set ‘binary_cache_s3_bucket’ in hydra.conf"); - auto store = make_ref( - _localStore, - hydraConfig["binary_cache_secret_key_file"], - bucketName); - store->init(); - _destStore = std::shared_ptr(store); + } else { + _destStore = openStoreAt(hydraConfig["store_uri"]); } {