system_keyspace, view: reduce interdependencies

system_keyspace is an implementation detail for most of its users, not
part of the interface, as it's only used to store internal data. Therefore,
including it in a header file causes unneeded dependencies.

This patch removes a dependency between views and system_keyspace.hh
by moving view_name and view_build_progress into a separate header file,
and using forward declarations where possible. This allows us to
remove an inclusion of system_keyspace.hh from a header file (the last
one), so that further changes to system_keyspace.hh will cause fewer
recompilations.
Message-Id: <20181228215736.11493-1-avi@scylladb.com>
This commit is contained in:
Avi Kivity
2018-12-28 23:57:36 +02:00
committed by Duarte Nunes
parent bab7e6877b
commit 0c0cc66ee7
5 changed files with 59 additions and 7 deletions

View File

@@ -62,6 +62,7 @@
#include "query_context.hh"
#include "partition_slice_builder.hh"
#include "db/config.hh"
#include "system_keyspace_view_types.hh"
#include "schema_builder.hh"
#include "md5_hasher.hh"
#include "release.hh"

View File

@@ -127,12 +127,7 @@ struct range_estimates {
};
using view_name = std::pair<sstring, sstring>;
struct view_build_progress {
view_name view;
dht::token first_token;
std::optional<dht::token> next_token;
shard_id cpu_id;
};
struct view_build_progress;
extern schema_ptr hints();
extern schema_ptr batchlog();

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2018 ScyllaDB
*/
/*
* This file is part of Scylla.
*
* Scylla is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Scylla is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <seastar/core/reactor.hh>
#include <seastar/core/sstring.hh>
#include <utility>
#include <optional>
#include "seastarx.hh"
namespace dht {
class token;
}
namespace db::system_keyspace {
using view_name = std::pair<sstring, sstring>;
struct view_build_progress {
view_name view;
dht::token first_token;
std::optional<dht::token> next_token;
shard_id cpu_id;
};
}

View File

@@ -58,6 +58,8 @@
#include "cql3/util.hh"
#include "db/view/view.hh"
#include "db/view/view_builder.hh"
#include "db/system_keyspace_view_types.hh"
#include "db/system_keyspace.hh"
#include "frozen_mutation.hh"
#include "gms/inet_address.hh"
#include "keys.hh"

View File

@@ -22,7 +22,6 @@
#pragma once
#include "database_fwd.hh"
#include "db/system_keyspace.hh"
#include "db/system_distributed_keyspace.hh"
#include "dht/i_partitioner.hh"
#include "keys.hh"
@@ -46,6 +45,14 @@
#include <unordered_map>
#include <vector>
namespace db::system_keyspace {
using view_name = std::pair<sstring, sstring>;
class view_build_progress;
}
namespace db::view {
/**