locator: resolve the dependency of token_metadata.hh on token_range_splitter.hh

define token_metadata_ptr in token_metadata_fwd.hh
So that the declaration of `make_splitter` can be moved
to token_range_splitter.hh, where it belongs,
and so token_metadata.hh won't have to include it.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2023-11-02 21:49:55 +02:00
parent 182e5381d8
commit 6de1cc2993
3 changed files with 23 additions and 5 deletions

View File

@@ -15,7 +15,6 @@
#include <unordered_map>
#include "gms/inet_address.hh"
#include "dht/i_partitioner.hh"
#include "locator/token_range_splitter.hh"
#include "inet_address_vectors.hh"
#include <optional>
#include <memory>
@@ -31,6 +30,7 @@
#include "locator/types.hh"
#include "locator/topology.hh"
#include "locator/token_metadata_fwd.hh"
// forward declaration since replica/database.hh includes this file
namespace replica {
@@ -304,8 +304,6 @@ struct topology_change_info {
future<> clear_gently();
};
using token_metadata_ptr = lw_shared_ptr<const token_metadata>;
using mutable_token_metadata_ptr = lw_shared_ptr<token_metadata>;
using token_metadata_lock = semaphore_units<>;
using token_metadata_lock_func = noncopyable_function<future<token_metadata_lock>() noexcept>;
@@ -395,6 +393,4 @@ public:
static future<> mutate_on_all_shards(sharded<shared_token_metadata>& stm, seastar::noncopyable_function<future<> (token_metadata&)> func);
};
std::unique_ptr<locator::token_range_splitter> make_splitter(token_metadata_ptr);
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2023-present ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#include <seastar/core/shared_ptr.hh>
#include "seastarx.hh"
namespace locator {
class token_metadata;
using token_metadata_ptr = lw_shared_ptr<const token_metadata>;
using mutable_token_metadata_ptr = lw_shared_ptr<token_metadata>;
} // namespace locator

View File

@@ -10,6 +10,7 @@
#include "dht/i_partitioner.hh"
#include "dht/token.hh"
#include "locator/token_metadata_fwd.hh"
#include <optional>
@@ -39,4 +40,6 @@ public:
virtual std::optional<dht::token> next_token() = 0;
};
std::unique_ptr<locator::token_range_splitter> make_splitter(token_metadata_ptr);
}