From 1d4805236b6e46d19bb8f8b7a4255d7afab1c5d1 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 15 Jul 2015 17:11:10 +0300 Subject: [PATCH] messaging_service: don't include config.hh in .hh config.hh changes rapidly, so don't force lots of recompiles by including it. Need to place seed_provider_type in namespace scope, so we can forward declare it for that. --- api/storage_service.cc | 1 + db/batchlog_manager.cc | 1 + db/config.hh | 35 +++++++++++++++++++---------------- db/system_keyspace.cc | 1 + message/messaging_service.cc | 3 ++- message/messaging_service.hh | 7 +++++-- service/storage_proxy.cc | 1 + tests/urchin/cql_test_env.cc | 1 + 8 files changed, 31 insertions(+), 19 deletions(-) diff --git a/api/storage_service.cc b/api/storage_service.cc index 7503537cea..3281c32f07 100644 --- a/api/storage_service.cc +++ b/api/storage_service.cc @@ -4,6 +4,7 @@ #include "storage_service.hh" #include "api/api-doc/storage_service.json.hh" +#include "db/config.hh" #include #include #include diff --git a/db/batchlog_manager.cc b/db/batchlog_manager.cc index 63940c9e76..74b109ee86 100644 --- a/db/batchlog_manager.cc +++ b/db/batchlog_manager.cc @@ -34,6 +34,7 @@ #include "db_clock.hh" #include "database.hh" #include "unimplemented.hh" +#include "db/config.hh" static logging::logger logger("BatchLog Manager"); diff --git a/db/config.hh b/db/config.hh index 865cb95539..41956b281b 100644 --- a/db/config.hh +++ b/db/config.hh @@ -14,6 +14,24 @@ class file; namespace db { +typedef std::unordered_map string_map; + +/* + * This type is not use, and probably never will be. + * So it makes sense to jump through hoops just to ensure + * it is in fact handled properly... + */ +struct seed_provider_type { + seed_provider_type() = default; + seed_provider_type(sstring n, + std::initializer_list opts = + { }) + : class_name(std::move(n)), parameters(std::move(opts)) { + } + sstring class_name; + string_map parameters; +}; + class config { public: enum class value_status { @@ -79,22 +97,7 @@ public: typedef std::unordered_map string_map; typedef std::vector string_list; - - /* - * This type is not use, and probably never will be. - * So it makes sense to jump through hoops just to ensure - * it is in fact handled properly... - */ - struct seed_provider_type { - seed_provider_type() = default; - seed_provider_type(sstring n, - std::initializer_list opts = - { }) - : class_name(std::move(n)), parameters(std::move(opts)) { - } - sstring class_name; - string_map parameters; - }; + using seed_provider_type = db::seed_provider_type; /* * All values and documentation taken from diff --git a/db/system_keyspace.cc b/db/system_keyspace.cc index f97abe55cf..6e6979c75a 100644 --- a/db/system_keyspace.cc +++ b/db/system_keyspace.cc @@ -41,6 +41,7 @@ #include "db/serializer.hh" #include "query_context.hh" #include "partition_slice_builder.hh" +#include "db/config.hh" using days = std::chrono::duration>; diff --git a/message/messaging_service.cc b/message/messaging_service.cc index a30f3f32c9..2555d29ee1 100644 --- a/message/messaging_service.cc +++ b/message/messaging_service.cc @@ -8,6 +8,7 @@ #include "gms/gossiper.hh" #include "service/storage_service.hh" #include "streaming/messages/stream_init_message.hh" +#include "db/config.hh" namespace net { @@ -68,7 +69,7 @@ future<> deinit_messaging_service() { }); } -future<> init_messaging_service(sstring listen_address, db::config::seed_provider_type seed_provider) { +future<> init_messaging_service(sstring listen_address, db::seed_provider_type seed_provider) { const gms::inet_address listen(listen_address); std::set seeds; if (seed_provider.parameters.count("seeds") > 0) { diff --git a/message/messaging_service.hh b/message/messaging_service.hh index a637d90838..1b94822114 100644 --- a/message/messaging_service.hh +++ b/message/messaging_service.hh @@ -14,7 +14,6 @@ #include "gms/inet_address.hh" #include "rpc/rpc.hh" #include -#include "db/config.hh" #include "frozen_mutation.hh" #include "query-request.hh" #include "db/serializer.hh" @@ -25,6 +24,10 @@ namespace streaming { namespace messages { class stream_init_message; }} +namespace db { +class seed_provider_type; +} + namespace net { /* All verb handler identifiers */ @@ -372,5 +375,5 @@ inline messaging_service& get_local_messaging_service() { return _the_messaging_service.local(); } -future<> init_messaging_service(sstring listen_address, db::config::seed_provider_type seed_provider); +future<> init_messaging_service(sstring listen_address, db::seed_provider_type seed_provider); } // namespace net diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 472d32b50e..bf1ed1ecbd 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -37,6 +37,7 @@ #include "storage_service.hh" #include "core/future-util.hh" #include "db/read_repair_decision.hh" +#include "db/config.hh" #include #include #include diff --git a/tests/urchin/cql_test_env.cc b/tests/urchin/cql_test_env.cc index ae53091f7f..b8666d8139 100644 --- a/tests/urchin/cql_test_env.cc +++ b/tests/urchin/cql_test_env.cc @@ -11,6 +11,7 @@ #include "utils/UUID_gen.hh" #include "message/messaging_service.hh" #include "service/storage_service.hh" +#include "db/config.hh" class in_memory_cql_env : public cql_test_env { public: