token_metadata: make it a template with NodeId=inet_address/host_id
NodeId is used in all internal token_metadata data structures, that previously used inet_address. We choose topology::key_kind based on the value of the template parameter. generic_token_metadata::update_topology overload with host_id parameter is added to make update_topology_change_info work, it now uses NodeId as a parameter type. topology::remove_endpoint(host_id) is added to make generic_token_metadata::remove_endpoint(NodeId) work. pending_endpoints_for and endpoints_for_reading are just removed - they are not used and not implemented. The declarations were left by mistake from a refactoring in which these methods were moved to erm. generic_token_metadata_base is extracted to contain declarations, common to both token_metadata versions. Templates are explicitly instantiated inside token_metadata.cc, since implementation part is also a template and it's not exposed to the header. There are no other behavioral changes in this commit, just syntax fixes to make token_metadata a template.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <seastar/core/future.hh>
|
||||
#include "streaming/stream_reason.hh"
|
||||
#include "locator/host_id.hh"
|
||||
#include "seastarx.hh"
|
||||
|
||||
namespace replica {
|
||||
@@ -23,7 +24,10 @@ class system_distributed_keyspace;
|
||||
}
|
||||
|
||||
namespace locator {
|
||||
class token_metadata;
|
||||
template <typename NodeId>
|
||||
class generic_token_metadata;
|
||||
using token_metadata = generic_token_metadata<gms::inet_address>;
|
||||
using token_metadata2 = generic_token_metadata<host_id>;
|
||||
}
|
||||
|
||||
namespace db::view {
|
||||
|
||||
Reference in New Issue
Block a user