Skip to content

Commit

Permalink
treewide: reduce header interdependencies
Browse files Browse the repository at this point in the history
Use forward declarations wherever possible.

Signed-off-by: Pavel Solodovnikov <[email protected]>

Closes scylladb#8813
  • Loading branch information
Pavel Solodovnikov authored and avikivity committed Jun 7, 2021
1 parent 0048c40 commit 76bea23
Show file tree
Hide file tree
Showing 163 changed files with 396 additions and 238 deletions.
1 change: 0 additions & 1 deletion atomic_cell.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "tombstone.hh"
#include "gc_clock.hh"
#include "utils/managed_bytes.hh"
#include "utils/fragment_range.hh"
#include <seastar/net//byteorder.hh>
#include <seastar/util/bool_class.hh>
#include <cstdint>
Expand Down
3 changes: 1 addition & 2 deletions cache_flat_mutation_reader.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
#include "row_cache.hh"
#include "mutation_reader.hh"
#include "mutation_fragment.hh"
#include "partition_version.hh"
#include "utils/logalloc.hh"
#include "query-request.hh"
#include "partition_snapshot_row_cursor.hh"
#include "read_context.hh"
#include "flat_mutation_reader.hh"
#include "clustering_key_filter.hh"

namespace cache {

Expand Down
2 changes: 2 additions & 0 deletions canonical_mutation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include "canonical_mutation.hh"
#include "mutation.hh"
#include "mutation_partition_view.hh"
#include "mutation_partition_visitor.hh"
#include "mutation_partition_serializer.hh"
#include "counters.hh"
#include "converting_mutation_partition_applier.hh"
Expand Down
7 changes: 5 additions & 2 deletions canonical_mutation.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
#include "bytes.hh"
#include "schema_fwd.hh"
#include "database_fwd.hh"
#include "mutation_partition_visitor.hh"
#include "mutation_partition_serializer.hh"
#include "bytes_ostream.hh"
#include <iosfwd>

namespace utils {
class UUID;
} // namespace utils

// Immutable mutation form which can be read using any schema version of the same table.
// Safe to access from other shards via const&.
// Safe to pass serialized across nodes.
Expand Down
1 change: 1 addition & 0 deletions cdc/generation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "gms/inet_address.hh"
#include "gms/gossiper.hh"
#include "gms/feature_service.hh"
#include "utils/UUID_gen.hh"

#include "cdc/generation.hh"
#include "cdc/cdc_options.hh"
Expand Down
1 change: 0 additions & 1 deletion cell_locking.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <boost/intrusive/unordered_set.hpp>

#include "utils/small_vector.hh"
#include "mutation_fragment.hh"
#include "mutation_partition.hh"
#include "xx_hasher.hh"

Expand Down
3 changes: 2 additions & 1 deletion compaction_garbage_collector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@

#pragma once

#include "collection_mutation.hh"
#include "schema_fwd.hh"

class atomic_cell;
class row_marker;
struct collection_mutation_description;

class compaction_garbage_collector {
public:
Expand Down
2 changes: 1 addition & 1 deletion compaction_strategy.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
#include "schema_fwd.hh"
#include "sstables/shared_sstable.hh"
#include "exceptions/exceptions.hh"
#include "sstables/compaction_backlog_manager.hh"
#include "compaction_strategy_type.hh"

class table;
using column_family = table;

class flat_mutation_reader;
struct mutation_source_metadata;
class compaction_backlog_tracker;

namespace sstables {

Expand Down
2 changes: 1 addition & 1 deletion compatible_ring_position.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#pragma once

#include "query-request.hh"
#include "dht/i_partitioner.hh"
#include <optional>
#include <variant>

Expand Down
5 changes: 5 additions & 0 deletions converting_mutation_partition_applier.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@
#pragma once

#include "mutation_partition_visitor.hh"
#include "atomic_cell.hh"
#include "schema.hh" // temporary: bring in definition of `column_kind`

class schema;
class row;
class mutation_partition;
class column_mapping;
class deletable_row;
class column_definition;
class abstract_type;
class atomic_cell_or_collection;

// Mutation partition visitor which applies visited data into
// existing mutation_partition. The visited data may be of a different schema.
Expand Down
1 change: 1 addition & 0 deletions cql3/attributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*/

#include "cql3/attributes.hh"
#include "cql3/column_identifier.hh"

namespace cql3 {

Expand Down
1 change: 1 addition & 0 deletions cql3/authorized_prepared_statements_cache.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#pragma once

#include "cql3/prepared_statements_cache.hh"
#include "auth/authenticated_user.hh"

namespace cql3 {

Expand Down
27 changes: 14 additions & 13 deletions cql3/cql_statement.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@

#pragma once

#include "service/client_state.hh"
#include "service/query_state.hh"
#include "cql3/query_options.hh"
#include "timeout_config.hh"

namespace service {

class storage_proxy;
class query_state;
class client_state;

}

Expand All @@ -67,13 +66,15 @@ namespace cql3 {
class query_processor;

class metadata;
shared_ptr<const metadata> make_empty_metadata();
seastar::shared_ptr<const metadata> make_empty_metadata();

class query_options;

class cql_statement {
timeout_config_selector _timeout_config_selector;
public:
// CQL statement text
sstring raw_cql_statement;
seastar::sstring raw_cql_statement;

explicit cql_statement(timeout_config_selector timeout_selector) : _timeout_config_selector(timeout_selector) {}

Expand All @@ -89,7 +90,7 @@ public:
*
* @param state the current client state
*/
virtual future<> check_access(service::storage_proxy& proxy, const service::client_state& state) const = 0;
virtual seastar::future<> check_access(service::storage_proxy& proxy, const service::client_state& state) const = 0;

/**
* Perform additional validation required by the statment.
Expand All @@ -105,14 +106,14 @@ public:
* @param state the current query state
* @param options options for this query (consistency, variables, pageSize, ...)
*/
virtual future<::shared_ptr<cql_transport::messages::result_message>>
virtual seastar::future<seastar::shared_ptr<cql_transport::messages::result_message>>
execute(query_processor& qp, service::query_state& state, const query_options& options) const = 0;

virtual bool depends_on_keyspace(const sstring& ks_name) const = 0;
virtual bool depends_on_keyspace(const seastar::sstring& ks_name) const = 0;

virtual bool depends_on_column_family(const sstring& cf_name) const = 0;
virtual bool depends_on_column_family(const seastar::sstring& cf_name) const = 0;

virtual shared_ptr<const metadata> get_result_metadata() const = 0;
virtual seastar::shared_ptr<const metadata> get_result_metadata() const = 0;

virtual bool is_conditional() const {
return false;
Expand All @@ -122,7 +123,7 @@ public:
class cql_statement_no_metadata : public cql_statement {
public:
using cql_statement::cql_statement;
virtual shared_ptr<const metadata> get_result_metadata() const override {
virtual seastar::shared_ptr<const metadata> get_result_metadata() const override {
return make_empty_metadata();
}
};
Expand All @@ -133,10 +134,10 @@ public:
class cql_statement_opt_metadata : public cql_statement {
protected:
// Result set metadata, may be empty for simple updates and batches
shared_ptr<metadata> _metadata;
seastar::shared_ptr<metadata> _metadata;
public:
using cql_statement::cql_statement;
virtual shared_ptr<const metadata> get_result_metadata() const override {
virtual seastar::shared_ptr<const metadata> get_result_metadata() const override {
if (_metadata) {
return _metadata;
}
Expand Down
2 changes: 2 additions & 0 deletions cql3/expr/expression.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
#include "cql3/lists.hh"
#include "cql3/statements/request_validations.hh"
#include "cql3/tuples.hh"
#include "cql3/selection/selection.hh"
#include "index/secondary_index_manager.hh"
#include "types/list.hh"
#include "types/map.hh"
#include "types/set.hh"
#include "utils/like_matcher.hh"
#include "query-result-reader.hh"

namespace cql3 {
namespace expr {
Expand Down
16 changes: 12 additions & 4 deletions cql3/expr/expression.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,33 @@
#include <concepts>

#include "bytes.hh"
#include "cql3/query_options.hh"
#include "cql3/selection/selection.hh"
#include "cql3/statements/bound.hh"
#include "cql3/term.hh"
#include "database_fwd.hh"
#include "gc_clock.hh"
#include "mutation_partition.hh"
#include "query-result-reader.hh"
#include "range.hh"
#include "seastarx.hh"
#include "utils/overloaded_functor.hh"

class row;

namespace secondary_index {
class index;
class secondary_index_manager;
} // namespace secondary_index

namespace query {
class result_row_view;
} // namespace query

namespace cql3 {

class query_options;

namespace selection {
class selection;
} // namespace selection

namespace expr {

struct allow_local_index_tag {};
Expand Down
2 changes: 2 additions & 0 deletions cql3/functions/abstract_function.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include <iosfwd>
#include <boost/functional/hash.hpp>

#include "cql3/functions/function_name.hh"

namespace std {
std::ostream& operator<<(std::ostream& os, const std::vector<data_type>& arg_types);
}
Expand Down
1 change: 1 addition & 0 deletions cql3/functions/as_json_function.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

#include "cql3/functions/function.hh"
#include "cql3/functions/scalar_function.hh"
#include "cql3/functions/function_name.hh"
#include "cql3/cql3_type.hh"
#include "cql3/type_json.hh"

Expand Down
3 changes: 2 additions & 1 deletion cql3/functions/function.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@

#pragma once

#include "function_name.hh"
#include "types.hh"
#include <vector>
#include <optional>

namespace cql3 {
namespace functions {

class function_name;

class function {
public:
using opt_bytes = std::optional<bytes>;
Expand Down
1 change: 1 addition & 0 deletions cql3/functions/function_call.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "scalar_function.hh"
#include "cql3/term.hh"
#include "exceptions/exceptions.hh"
#include "cql3/functions/function_name.hh"

namespace cql3 {
namespace functions {
Expand Down
1 change: 1 addition & 0 deletions cql3/functions/token_fct.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "native_scalar_function.hh"
#include "dht/i_partitioner.hh"
#include "utils/UUID.hh"
#include "unimplemented.hh"

namespace cql3 {
namespace functions {
Expand Down
1 change: 1 addition & 0 deletions cql3/operation.hh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "database_fwd.hh"
#include "term.hh"
#include "update_parameters.hh"
#include "cql3/column_identifier.hh"

#include <optional>

Expand Down
2 changes: 2 additions & 0 deletions cql3/prepared_statements_cache.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#pragma once

#include "utils/loading_cache.hh"
#include "utils/hash.hh"
#include "cql3/statements/prepared_statement.hh"
#include "cql3/column_specification.hh"

namespace cql3 {

Expand Down
1 change: 1 addition & 0 deletions cql3/query_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "query_options.hh"
#include "version.hh"
#include "db/consistency_level_type.hh"
#include "cql3/column_identifier.hh"

namespace cql3 {

Expand Down
4 changes: 2 additions & 2 deletions cql3/query_options.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
#include "db/consistency_level_type.hh"
#include "service/query_state.hh"
#include "service/pager/paging_state.hh"
#include "cql3/column_specification.hh"
#include "cql3/column_identifier.hh"
#include "cql3/values.hh"
#include "cql_serialization_format.hh"

Expand All @@ -57,6 +55,8 @@ namespace cql3 {
class cql_config;
extern const cql_config default_cql_config;

class column_specification;

/**
* Options for a query.
*/
Expand Down
1 change: 1 addition & 0 deletions cql3/query_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "cql3/CqlParser.hpp"
#include "cql3/error_collector.hh"
#include "cql3/statements/batch_statement.hh"
#include "cql3/statements/modification_statement.hh"
#include "cql3/util.hh"
#include "cql3/untyped_result_set.hh"
#include "db/config.hh"
Expand Down
Loading

0 comments on commit 76bea23

Please sign in to comment.