Documentation ¶
Overview ¶
Package topoproto contains utility functions to deal with the proto3 structures defined in proto/topodata.
Index ¶
- Variables
- func IsTypeInList(tabletType pb.TabletType, types []pb.TabletType) bool
- func MakeStringTypeList(types []pb.TabletType) []string
- func ParseKeyspaceShard(param string) (string, string, error)
- func ParseTabletAlias(aliasStr string) (*pb.TabletAlias, error)
- func ParseTabletType(param string) (pb.TabletType, error)
- func ParseUID(value string) (uint32, error)
- func SourceShardAsHTML(source *pb.Shard_SourceShard) template.HTML
- func SourceShardString(source *pb.Shard_SourceShard) string
- func TabletAddr(tablet *pb.Tablet) string
- func TabletAliasEqual(left, right *pb.TabletAlias) bool
- func TabletAliasIsZero(ta *pb.TabletAlias) bool
- func TabletAliasString(ta *pb.TabletAlias) string
- func TabletAliasUIDStr(ta *pb.TabletAlias) string
- func TabletDbName(tablet *pb.Tablet) string
- func TabletIsAssigned(tablet *pb.Tablet) bool
- type TabletAliasList
Constants ¶
This section is empty.
Variables ¶
var AllTabletTypes = []pb.TabletType{ pb.TabletType_IDLE, pb.TabletType_MASTER, pb.TabletType_REPLICA, pb.TabletType_RDONLY, pb.TabletType_BATCH, pb.TabletType_SPARE, pb.TabletType_EXPERIMENTAL, pb.TabletType_SCHEMA_UPGRADE, pb.TabletType_BACKUP, pb.TabletType_RESTORE, pb.TabletType_WORKER, pb.TabletType_SCRAP, }
AllTabletTypes lists all the possible tablet types
var SlaveTabletTypes = []pb.TabletType{ pb.TabletType_REPLICA, pb.TabletType_RDONLY, pb.TabletType_BATCH, pb.TabletType_SPARE, pb.TabletType_EXPERIMENTAL, pb.TabletType_SCHEMA_UPGRADE, pb.TabletType_BACKUP, pb.TabletType_RESTORE, pb.TabletType_WORKER, }
SlaveTabletTypes contains all the tablet type that can have replication enabled.
Functions ¶
func IsTypeInList ¶
func IsTypeInList(tabletType pb.TabletType, types []pb.TabletType) bool
IsTypeInList returns true if the given type is in the list. Use it with AllTabletType and SlaveTabletType for instance.
func MakeStringTypeList ¶
func MakeStringTypeList(types []pb.TabletType) []string
MakeStringTypeList returns a list of strings that match the input list.
func ParseKeyspaceShard ¶
ParseKeyspaceShard parse a "keyspace/shard" string and extract both keyspace and shard
func ParseTabletAlias ¶
func ParseTabletAlias(aliasStr string) (*pb.TabletAlias, error)
ParseTabletAlias returns a TabletAlias for the input string, of the form <cell>-<uid>
func ParseTabletType ¶
func ParseTabletType(param string) (pb.TabletType, error)
ParseTabletType parses the tablet type into the enum
func SourceShardAsHTML ¶
func SourceShardAsHTML(source *pb.Shard_SourceShard) template.HTML
SourceShardAsHTML returns a HTML version of the object.
func SourceShardString ¶
func SourceShardString(source *pb.Shard_SourceShard) string
SourceShardString returns a printable view of a SourceShard.
func TabletAddr ¶
TabletAddr returns hostname:vt port associated with a tablet
func TabletAliasEqual ¶
func TabletAliasEqual(left, right *pb.TabletAlias) bool
TabletAliasEqual returns true if two TabletAlias match
func TabletAliasIsZero ¶
func TabletAliasIsZero(ta *pb.TabletAlias) bool
TabletAliasIsZero returns true iff cell and uid are empty
func TabletAliasString ¶
func TabletAliasString(ta *pb.TabletAlias) string
TabletAliasString formats a TabletAlias
func TabletAliasUIDStr ¶
func TabletAliasUIDStr(ta *pb.TabletAlias) string
TabletAliasUIDStr returns a string version of the uid
func TabletDbName ¶
TabletDbName is usually implied by keyspace. Having the shard information in the database name complicates mysql replication.
func TabletIsAssigned ¶
TabletIsAssigned returns if this tablet is assigned to a keyspace and shard. A "scrap" node will show up as assigned even though its data cannot be used for serving.
Types ¶
type TabletAliasList ¶
type TabletAliasList []*pb.TabletAlias
TabletAliasList is used mainly for sorting
func (TabletAliasList) Less ¶
func (tal TabletAliasList) Less(i, j int) bool
Less is part of sort.Interface
func (TabletAliasList) Swap ¶
func (tal TabletAliasList) Swap(i, j int)
Swap is part of sort.Interface