Esempio n. 1
0
// changeType is a single iteration of the update loop for ChangeType().
func changeType(tablet *topodatapb.Tablet, newType topodatapb.TabletType, health map[string]string) error {
	tablet.Type = newType
	if health != nil {
		if len(health) == 0 {
			tablet.HealthMap = nil
		} else {
			tablet.HealthMap = health
		}
	}
	return nil
}
Esempio n. 2
0
// changeType is a single iteration of the update loop for ChangeType().
func changeType(tablet *topodatapb.Tablet, newType topodatapb.TabletType, health map[string]string) error {
	if !topo.IsTrivialTypeChange(tablet.Type, newType) {
		return fmt.Errorf("cannot change tablet type %v -> %v for %v", tablet.Type, newType, tablet.Alias)
	}

	tablet.Type = newType
	if health != nil {
		if len(health) == 0 {
			tablet.HealthMap = nil
		} else {
			tablet.HealthMap = health
		}
	}
	return nil
}