Token metadata: Enhencing the API

This expose the _leaving_endpoints, _moving_endpoints and
_bootstrap_tokens.

It also changes the signature of get_endpoint_to_host_id_map_for_reading
from auto so the compiler will be able to resolve the method signature
outside of the cc file.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
Amnon Heiman
2015-06-22 15:11:39 +03:00
parent 3f5114e415
commit b4d2180b9b
2 changed files with 13 additions and 2 deletions

View File

@@ -180,7 +180,7 @@ gms::inet_address token_metadata::get_endpoint_for_host_id(UUID host_id) {
return (*it).first;
}
const auto& token_metadata::get_endpoint_to_host_id_map_for_reading() {
const std::unordered_map<inet_address, utils::UUID>& token_metadata::get_endpoint_to_host_id_map_for_reading() const{
return _endpoint_to_host_id_map;
}

View File

@@ -80,6 +80,17 @@ public:
const std::map<token, inet_address>& get_token_to_endpoint() const {
return _token_to_endpoint_map;
}
const std::unordered_set<inet_address>& get_leaving_endpoints() const {
return _leaving_endpoints;
}
const std::unordered_map<token, inet_address>& get_moving_endpoints() const {
return _moving_endpoints;
}
const std::unordered_map<token, inet_address>& get_bootstrap_tokens() const {
return _bootstrap_tokens;
}
void debug_show();
#if 0
private static final Logger logger = LoggerFactory.getLogger(TokenMetadata.class);
@@ -267,7 +278,7 @@ public:
inet_address get_endpoint_for_host_id(UUID host_id);
/** @return a copy of the endpoint-to-id map for read-only operations */
const auto& get_endpoint_to_host_id_map_for_reading();
const std::unordered_map<inet_address, utils::UUID>& get_endpoint_to_host_id_map_for_reading() const;
void add_bootstrap_token(token t, inet_address endpoint);