Esempio n. 1
0
// 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 {
		return topodatapb.TabletType_UNKNOWN, fmt.Errorf("unknown TabletType %v", param)
	}
	return topodatapb.TabletType(value), nil
}
Esempio n. 2
0
// TargetToProto3 transform the bson RPC target to proto3
func TargetToProto3(target *Target) *pb.Target {
	if target == nil {
		return nil
	}
	return &pb.Target{
		Keyspace:   target.Keyspace,
		Shard:      target.Shard,
		TabletType: pbt.TabletType(target.TabletType),
	}
}
Esempio n. 3
0
// TargetToProto3 transform the bson RPC target to proto3
func TargetToProto3(target *Target) *querypb.Target {
	if target == nil {
		return nil
	}
	return &querypb.Target{
		Keyspace:   target.Keyspace,
		Shard:      target.Shard,
		TabletType: topodatapb.TabletType(target.TabletType),
	}
}
Esempio n. 4
0
// TabletTypeToProto turns a TabletType into a proto
func TabletTypeToProto(t TabletType) pb.TabletType {
	if result, ok := pb.TabletType_value[strings.ToUpper(string(t))]; ok {
		return pb.TabletType(result)
	}
	panic(fmt.Errorf("unknown tablet type: %v", t))
}