From fcd6f147fcbe966b683449d8d033a683bf2a5faa Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 3 Jun 2015 19:52:58 +0300 Subject: [PATCH] db/legacy_schema_tables.cc: Use schema_result::value_type instead of std::pair Switch to schema_result::value_type instead of the open-coded std::pair so that the actual types are defined in one place. Signed-off-by: Pekka Enberg --- db/legacy_schema_tables.cc | 14 +++++++------- db/legacy_schema_tables.hh | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/db/legacy_schema_tables.cc b/db/legacy_schema_tables.cc index ec523e4295..1cc65aaa2a 100644 --- a/db/legacy_schema_tables.cc +++ b/db/legacy_schema_tables.cc @@ -418,14 +418,14 @@ std::vector ALL { KEYSPACES, COLUMNFAMILIES, COLUMNS, TRIGGERS, USE } #endif - future>> + future read_schema_partition_for_keyspace(service::storage_proxy& proxy, const sstring& schema_table_name, const sstring& keyspace_name) { auto schema = proxy.get_db().local().find_schema(system_keyspace::NAME, schema_table_name); auto keyspace_key = dht::global_partitioner().decorate_key(*schema, partition_key::from_single_value(*schema, to_bytes(keyspace_name))); return proxy.query_local(system_keyspace::NAME, schema_table_name, keyspace_key).then([keyspace_name] (auto&& rs) { - return std::make_pair(keyspace_name, std::move(rs)); + return schema_result::value_type{keyspace_name, std::move(rs)}; }); } @@ -538,7 +538,7 @@ std::vector ALL { KEYSPACES, COLUMNFAMILIES, COLUMNS, TRIGGERS, USE future> merge_keyspaces(service::storage_proxy& proxy, schema_result&& before, schema_result&& after) { - std::vector>> created; + std::vector created; std::vector altered; std::set dropped; @@ -552,14 +552,14 @@ std::vector ALL { KEYSPACES, COLUMNFAMILIES, COLUMNS, TRIGGERS, USE * that means that a keyspace had been recreated and dropped, and the recreated keyspace had never found a way * to this node */ - auto diff = difference(before, after, [](const lw_shared_ptr& x, const lw_shared_ptr& y) -> bool { + auto diff = difference(before, after, [](const auto& x, const auto& y) -> bool { return *x == *y; }); for (auto&& key : diff.entries_only_on_right) { auto&& value = after[key]; if (!value->empty()) { - created.emplace_back(std::make_pair(key, std::move(value))); + created.emplace_back(schema_result::value_type{key, std::move(value)}); } } for (auto&& key : diff.entries_differing) { @@ -573,7 +573,7 @@ std::vector ALL { KEYSPACES, COLUMNFAMILIES, COLUMNS, TRIGGERS, USE } else if (!pre->empty()) { dropped.emplace(keyspace_name); } else if (!post->empty()) { // a (re)created keyspace - created.emplace_back(std::make_pair(key, std::move(post))); + created.emplace_back(schema_result::value_type{key, std::move(post)}); } } return do_with(std::move(created), [&proxy, altered = std::move(altered)] (auto& created) { @@ -873,7 +873,7 @@ std::vector ALL { KEYSPACES, COLUMNFAMILIES, COLUMNS, TRIGGERS, USE * * @param partition Keyspace attributes in serialized form */ - lw_shared_ptr create_keyspace_from_schema_partition(const std::pair>& result) + lw_shared_ptr create_keyspace_from_schema_partition(const schema_result::value_type& result) { auto&& rs = result.second; if (rs->empty()) { diff --git a/db/legacy_schema_tables.hh b/db/legacy_schema_tables.hh index ef524b62c8..fa30d1a5ff 100644 --- a/db/legacy_schema_tables.hh +++ b/db/legacy_schema_tables.hh @@ -52,7 +52,7 @@ extern std::vector ALL; std::vector all_tables(); -future>> +future read_schema_partition_for_keyspace(service::storage_proxy& proxy, const sstring& schema_table_name, const sstring& keyspace_name); future<> merge_schema(service::storage_proxy& proxy, std::vector mutations); @@ -63,7 +63,7 @@ future> merge_keyspaces(service::storage_proxy& proxy, schema_ std::vector make_create_keyspace_mutations(lw_shared_ptr keyspace, api::timestamp_type timestamp, bool with_tables_and_types_and_functions = true); -lw_shared_ptr create_keyspace_from_schema_partition(const std::pair>& partition); +lw_shared_ptr create_keyspace_from_schema_partition(const schema_result::value_type& partition); mutation make_create_keyspace_mutation(lw_shared_ptr keyspace, api::timestamp_type timestamp, bool with_tables_and_types_and_functions = true);