token_metadata: Implement clone_after_all_left

This commit is contained in:
Asias He
2015-10-19 15:13:42 +08:00
parent 5abdc4323a
commit a6065397d9

View File

@@ -581,31 +581,24 @@ public:
return tm;
}
}
#endif
/**
* Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all
* current leave operations have finished.
*
* @return new token metadata
*/
public TokenMetadata cloneAfterAllLeft()
{
lock.readLock().lock();
try
{
TokenMetadata allLeftMetadata = cloneOnlyTokenMap();
token_metadata clone_after_all_left() {
auto all_left_metadata = clone_only_token_map();
for (InetAddress endpoint : _leaving_endpoints)
allLeftMetadata.removeEndpoint(endpoint);
for (auto endpoint : _leaving_endpoints) {
all_left_metadata.remove_endpoint(endpoint);
}
return allLeftMetadata;
}
finally
{
lock.readLock().unlock();
}
return all_left_metadata;
}
#if 0
/**
* Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all
* current leave, and move operations have finished.