genLocalTopicName is just like genTopicName(), but the generated name belongs to the current cluster node.
()
| 806 | |
| 807 | // genLocalTopicName is just like genTopicName(), but the generated name belongs to the current cluster node. |
| 808 | func (c *Cluster) genLocalTopicName() string { |
| 809 | topic := genTopicName() |
| 810 | if c == nil { |
| 811 | // Cluster not initialized, all topics are local |
| 812 | return topic |
| 813 | } |
| 814 | |
| 815 | // TODO: if cluster is large it may become too inefficient. |
| 816 | for c.ring.Get(topic) != c.thisNodeName { |
| 817 | topic = genTopicName() |
| 818 | } |
| 819 | return topic |
| 820 | } |
| 821 | |
| 822 | // isPartitioned checks if the cluster is partitioned due to network or other failure and if the |
| 823 | // current node is a part of the smaller partition. |
no test coverage detected