token_metadata: Add clone_after_all_settled
Needed by storage_service::range_relocator::calculate_to_from_streams.
This commit is contained in:
@@ -468,6 +468,21 @@ void token_metadata::add_leaving_endpoint(inet_address endpoint) {
|
||||
_leaving_endpoints.emplace(endpoint);
|
||||
}
|
||||
|
||||
token_metadata token_metadata::clone_after_all_settled() {
|
||||
token_metadata metadata = clone_only_token_map();
|
||||
|
||||
for (auto endpoint : _leaving_endpoints) {
|
||||
metadata.remove_endpoint(endpoint);
|
||||
}
|
||||
|
||||
|
||||
for (auto x : _moving_endpoints) {
|
||||
metadata.update_normal_token(x.first, x.second);
|
||||
}
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/////////////////// class topology /////////////////////////////////////////////
|
||||
inline void topology::clear() {
|
||||
_dc_endpoints.clear();
|
||||
|
||||
@@ -597,36 +597,15 @@ public:
|
||||
return all_left_metadata;
|
||||
}
|
||||
|
||||
#if 0
|
||||
public:
|
||||
/**
|
||||
* Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all
|
||||
* current leave, and move operations have finished.
|
||||
*
|
||||
* @return new token metadata
|
||||
*/
|
||||
public TokenMetadata cloneAfterAllSettled()
|
||||
{
|
||||
lock.readLock().lock();
|
||||
|
||||
try
|
||||
{
|
||||
TokenMetadata metadata = cloneOnlyTokenMap();
|
||||
|
||||
for (InetAddress endpoint : _leaving_endpoints)
|
||||
metadata.removeEndpoint(endpoint);
|
||||
|
||||
|
||||
for (Pair<Token, InetAddress> pair : _moving_endpoints)
|
||||
metadata.updateNormalToken(pair.left, pair.right);
|
||||
|
||||
return metadata;
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
token_metadata clone_after_all_settled();
|
||||
#if 0
|
||||
public InetAddress getEndpoint(Token token)
|
||||
{
|
||||
lock.readLock().lock();
|
||||
|
||||
Reference in New Issue
Block a user