Ejemplo n.º 1
0
func EndPointForTablet(tablet *topo.Tablet) (*topo.EndPoint, error) {
	entry := topo.NewAddr(tablet.Alias.Uid, tablet.Hostname)
	if err := tablet.ValidatePortmap(); err != nil {
		return nil, err
	}

	// TODO(szopa): Rename _vtocc to vt.
	entry.NamedPortMap = map[string]int{
		"_vtocc": tablet.Portmap["vt"],
		"_mysql": tablet.Portmap["mysql"],
	}
	if port, ok := tablet.Portmap["vts"]; ok {
		entry.NamedPortMap["_vts"] = port
	}
	return entry, nil
}