зеркало из https://github.com/github/vitess-gh.git
vttablet: Change comments, variables and help text to better reflect that the new method operates on a comma separated list.
This commit is contained in:
Родитель
ca6ea8ffcf
Коммит
c1d1690034
|
@ -146,7 +146,7 @@ var SlaveTabletTypes = []topodatapb.TabletType{
|
|||
topodatapb.TabletType_DRAINED,
|
||||
}
|
||||
|
||||
// ParseTabletType parses the tablet type into the enum
|
||||
// ParseTabletType parses the tablet type into the enum.
|
||||
func ParseTabletType(param string) (topodatapb.TabletType, error) {
|
||||
value, ok := topodatapb.TabletType_value[strings.ToUpper(param)]
|
||||
if !ok {
|
||||
|
@ -155,17 +155,17 @@ func ParseTabletType(param string) (topodatapb.TabletType, error) {
|
|||
return topodatapb.TabletType(value), nil
|
||||
}
|
||||
|
||||
// ParseTabletTypes parses the tablet type into the enum
|
||||
// ParseTabletTypes parses a comma separated list of tablet types and returns a slice with the respective enums.
|
||||
func ParseTabletTypes(param string) ([]topodatapb.TabletType, error) {
|
||||
var sourceTabletTypes []topodatapb.TabletType
|
||||
var tabletTypes []topodatapb.TabletType
|
||||
for _, typeStr := range strings.Split(param, ",") {
|
||||
t, err := ParseTabletType(typeStr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unknown tablet type: %v", typeStr)
|
||||
return nil, err
|
||||
}
|
||||
sourceTabletTypes = append(sourceTabletTypes, t)
|
||||
tabletTypes = append(tabletTypes, t)
|
||||
}
|
||||
return sourceTabletTypes, nil
|
||||
return tabletTypes, nil
|
||||
}
|
||||
|
||||
// TabletTypeLString returns a lower case version of the tablet type,
|
||||
|
|
|
@ -53,7 +53,7 @@ var (
|
|||
healthCheckTopologyRefresh = flag.Duration("binlog_player_healthcheck_topology_refresh", 30*time.Second, "refresh interval for re-reading the topology")
|
||||
healthcheckRetryDelay = flag.Duration("binlog_player_healthcheck_retry_delay", 5*time.Second, "delay before retrying a failed healthcheck")
|
||||
healthCheckTimeout = flag.Duration("binlog_player_healthcheck_timeout", time.Minute, "the health check timeout period")
|
||||
sourceTabletTypeStr = flag.String("binlog_player_tablet_type", "REPLICA", "which tablet type that is used as a source")
|
||||
sourceTabletTypeStr = flag.String("binlog_player_tablet_type", "REPLICA", "comma separated list of tablet types used as a source")
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче