Get a set of :class:`.Host` instances representing all of the replica nodes for a given :class:`.Token`.
(self, keyspace, token)
| 1765 | self.tokens_to_hosts_by_ks.pop(keyspace, None) |
| 1766 | |
| 1767 | def get_replicas(self, keyspace, token): |
| 1768 | """ |
| 1769 | Get a set of :class:`.Host` instances representing all of the |
| 1770 | replica nodes for a given :class:`.Token`. |
| 1771 | """ |
| 1772 | tokens_to_hosts = self.tokens_to_hosts_by_ks.get(keyspace, None) |
| 1773 | if tokens_to_hosts is None: |
| 1774 | self.rebuild_keyspace(keyspace, build_if_absent=True) |
| 1775 | tokens_to_hosts = self.tokens_to_hosts_by_ks.get(keyspace, None) |
| 1776 | |
| 1777 | if tokens_to_hosts: |
| 1778 | # The values in self.ring correspond to the end of the |
| 1779 | # token range up to and including the value listed. |
| 1780 | point = bisect_left(self.ring, token) |
| 1781 | if point == len(self.ring): |
| 1782 | return tokens_to_hosts[self.ring[0]] |
| 1783 | else: |
| 1784 | return tokens_to_hosts[self.ring[point]] |
| 1785 | return [] |
| 1786 | |
| 1787 | |
| 1788 | @total_ordering |