Rebuild our view of the topology from fresh rows from the system topology tables. For internal use only.
(self, partitioner, token_map)
| 274 | self.token_map.remove_keyspace(ksname) |
| 275 | |
| 276 | def rebuild_token_map(self, partitioner, token_map): |
| 277 | """ |
| 278 | Rebuild our view of the topology from fresh rows from the |
| 279 | system topology tables. |
| 280 | For internal use only. |
| 281 | """ |
| 282 | self.partitioner = partitioner |
| 283 | if partitioner.endswith('RandomPartitioner'): |
| 284 | token_class = MD5Token |
| 285 | elif partitioner.endswith('Murmur3Partitioner'): |
| 286 | token_class = Murmur3Token |
| 287 | elif partitioner.endswith('ByteOrderedPartitioner'): |
| 288 | token_class = BytesToken |
| 289 | else: |
| 290 | self.token_map = None |
| 291 | return |
| 292 | |
| 293 | token_to_host_owner = {} |
| 294 | ring = [] |
| 295 | for host, token_strings in token_map.items(): |
| 296 | for token_string in token_strings: |
| 297 | token = token_class.from_string(token_string) |
| 298 | ring.append(token) |
| 299 | token_to_host_owner[token] = host |
| 300 | |
| 301 | all_tokens = sorted(ring) |
| 302 | self.token_map = TokenMap( |
| 303 | token_class, token_to_host_owner, all_tokens, self) |
| 304 | |
| 305 | def get_replicas(self, keyspace, key): |
| 306 | """ |
no test coverage detected