MCPcopy Index your code
hub / github.com/tinode/chat / genLocalTopicName

Method genLocalTopicName

server/cluster.go:808–820  ·  view source on GitHub ↗

genLocalTopicName is just like genTopicName(), but the generated name belongs to the current cluster node.

()

Source from the content-addressed store, hash-verified

806
807// genLocalTopicName is just like genTopicName(), but the generated name belongs to the current cluster node.
808func (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.

Callers 1

subscribeMethod · 0.80

Calls 2

genTopicNameFunction · 0.70
GetMethod · 0.65

Tested by

no test coverage detected