diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-29T11·57+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-29T11·57+0200 |
commit | aa3bc3d5dcff5ff6567a4e00320cb9caa28c5a93 (patch) | |
tree | ca430fbdbfad473105b78384eb200dcce797fd0e /src/libstore/store-api.cc | |
parent | 21e9d183ccf4216a61e0bb89d7e2eb42ce092e85 (diff) |
Eliminate the substituter mechanism
Substitution is now simply a Store -> Store copy operation, most typically from BinaryCacheStore to LocalStore.
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 14932f9b0be7..2763f5ad4199 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -501,4 +501,39 @@ static RegisterStoreImplementation regStore([](const std::string & uri) -> std:: }); +std::list<ref<Store>> getDefaultSubstituters() +{ + struct State { + bool done = false; + std::list<ref<Store>> stores; + }; + static Sync<State> state_; + + auto state(state_.lock()); + + if (state->done) return state->stores; + + StringSet done; + + auto addStore = [&](const std::string & uri) { + if (done.count(uri)) return; + done.insert(uri); + state->stores.push_back(openStoreAt(uri)); + }; + + for (auto uri : settings.get("substituters", Strings())) + addStore(uri); + + for (auto uri : settings.get("binary-caches", Strings())) + addStore(uri); + + for (auto uri : settings.get("extra-binary-caches", Strings())) + addStore(uri); + + state->done = true; + + return state->stores; +} + + } |