INNER CODE UNIT · Go
func
rwynn/gtm · gtm.go:425
func (shard *ShardInfo) GetURL() string {
hostParts := strings.SplitN(shard.hostname, "/", 2)
if len(hostParts) == 2 {
// there might be multiple comma-separated hosts.
// for now, we just take the first one and ignore the rest.
hosts := strings.Split(hostParts[1], ",")
return "mongodb://" + hosts[0] + "/?replicaSet=" + hostParts[0]
} else {
return "mongodb://" + hostParts[0]
}
}
func (ctx *OpCtx) isStopped() bool {
ctx.lock.Lock()
defer ctx.lock.Unlock()
return ctx.stopped
}