本文整理汇总了Golang中github.com/youtube/vitess/go/vt/proto/topodata.Tablet类的典型用法代码示例。如果您正苦于以下问题:Golang Tablet类的具体用法?Golang Tablet怎么用?Golang Tablet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tablet类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TabletComplete
// TabletComplete validates and normalizes the tablet. If the shard name
// contains a '-' it is going to try to infer the keyrange from it.
func TabletComplete(tablet *pb.Tablet) error {
shard, kr, err := ValidateShardName(tablet.Shard)
if err != nil {
return err
}
tablet.Shard = shard
tablet.KeyRange = kr
return nil
}
示例2: changeType
// 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
}
示例3: changeType
// 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
}