API: Add a reference to storage_proxy into API context

The API needs to call the storage_proxy, for that a reference to the
distribute storage_proxy is added to the context and is set in main.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
Amnon Heiman
2015-07-12 14:10:56 +03:00
parent 0eeef904d7
commit d0ce45efbb
2 changed files with 5 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
#include "http/httpd.hh"
#include "database.hh"
#include "service/storage_proxy.hh"
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
@@ -17,7 +18,9 @@ struct http_context {
sstring api_dir;
http_server_control http_server;
distributed<database>& db;
http_context(distributed<database>& _db) : db(_db) {}
distributed<service::storage_proxy>& sp;
http_context(distributed<database>& _db, distributed<service::storage_proxy>&
_sp) : db(_db), sp(_sp) {}
};
future<> set_server(http_context& ctx);

View File

@@ -45,7 +45,7 @@ int main(int ac, char** av) {
distributed<database> db;
distributed<cql3::query_processor> qp;
distributed<service::storage_proxy> proxy;
api::http_context ctx(db);
api::http_context ctx(db, proxy);
return app.run(ac, av, [&] {
auto&& opts = app.configuration();