func New(cf *config) *mysqlStore { if cf == nil || cf.Zone == "" { panic("empty zone") } zkAddrs := ctx.ZoneZkAddrs(cf.Zone) if len(zkAddrs) == 0 { panic("empty zookeeper addr") } return &mysqlStore{ cf: cf, zkzone: zk.NewZkZone(zk.DefaultConfig(cf.Zone, zkAddrs)), // TODO session timeout shutdownCh: make(chan struct{}), refreshCh: make(chan struct{}), allowUnregisteredGroup: false, topicNames: mpool.NewIntern(), } }
package mysql import ( "crypto/md5" "fmt" "strings" "testing" "github.com/funkygao/gafka/ctx" "github.com/funkygao/gafka/mpool" ) var intern = mpool.NewIntern() func kafkaTopicWithStrConcat(m *mysqlStore, appid string, topic string, ver string) string { return appid + "." + topic + "." + ver } func kafkaTopicWithSprintf(m *mysqlStore, appid string, topic string, ver string) string { return fmt.Sprintf("%s.%s.%s", appid, topic, ver) } func kafkaTopicWithStringsJoin(m *mysqlStore, appid string, topic string, ver string) string { return strings.Join([]string{appid, topic, ver}, ".") } func kafkaTopicWithIntern(appid string, topic string, ver string) string { return intern.String(appid + "." + topic + "." + ver) } func kafkaTopicWithJoin(appid string, topic string, ver string) string {