go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/topo/topoproto Index | Files

package topoproto

import "gopkg.in/src-d/go-vitess.v1/vt/topo/topoproto"

Package topoproto contains utility functions to deal with the proto3 structures defined in proto/topodata.

Index

Package Files

destination.go flag.go shard.go srvkeyspace.go tablet.go

Variables

var AllTabletTypes = []topodatapb.TabletType{
    topodatapb.TabletType_MASTER,
    topodatapb.TabletType_REPLICA,
    topodatapb.TabletType_RDONLY,
    topodatapb.TabletType_BATCH,
    topodatapb.TabletType_SPARE,
    topodatapb.TabletType_EXPERIMENTAL,
    topodatapb.TabletType_BACKUP,
    topodatapb.TabletType_RESTORE,
    topodatapb.TabletType_DRAINED,
}

AllTabletTypes lists all the possible tablet types

var SlaveTabletTypes = []topodatapb.TabletType{
    topodatapb.TabletType_REPLICA,
    topodatapb.TabletType_RDONLY,
    topodatapb.TabletType_BATCH,
    topodatapb.TabletType_SPARE,
    topodatapb.TabletType_EXPERIMENTAL,
    topodatapb.TabletType_BACKUP,
    topodatapb.TabletType_RESTORE,
    topodatapb.TabletType_DRAINED,
}

SlaveTabletTypes contains all the tablet type that can have replication enabled.

func IsTypeInList Uses

func IsTypeInList(tabletType topodatapb.TabletType, types []topodatapb.TabletType) bool

IsTypeInList returns true if the given type is in the list. Use it with AllTabletType and SlaveTabletType for instance.

func KeyspaceShardString Uses

func KeyspaceShardString(keyspace, shard string) string

KeyspaceShardString returns a "keyspace/shard" string taking keyspace and shard as separate inputs.

func MakeStringTypeList Uses

func MakeStringTypeList(types []topodatapb.TabletType) []string

MakeStringTypeList returns a list of strings that match the input list.

func MySQLIP Uses

func MySQLIP(tablet *topodatapb.Tablet) (string, error)

MySQLIP returns the MySQL server's IP by resolvign the host name.

func MysqlAddr Uses

func MysqlAddr(tablet *topodatapb.Tablet) string

MysqlAddr returns the host:port of the mysql server.

func MysqlHostname Uses

func MysqlHostname(tablet *topodatapb.Tablet) string

MysqlHostname returns the mysql host name. This function also handles legacy behavior: it uses the tablet's hostname if MysqlHostname is not specified. TODO(sougou); deprecate this function after 3.0.

func MysqlPort Uses

func MysqlPort(tablet *topodatapb.Tablet) int32

MysqlPort returns the mysql port. This function also handles legacy behavior: it uses the tablet's port map if MysqlHostname is not specified. TODO(sougou); deprecate this function after 3.0.

func ParseDestination Uses

func ParseDestination(targetString string, defaultTabletType topodatapb.TabletType) (string, topodatapb.TabletType, key.Destination, error)

ParseDestination parses the string representation of a Destionation of the form keyspace:shard@tablet_type. You can use a / instead of a :.

func ParseKeyspaceShard Uses

func ParseKeyspaceShard(param string) (string, string, error)

ParseKeyspaceShard parse a "keyspace/shard" string and extract both keyspace and shard

func ParseTabletAlias Uses

func ParseTabletAlias(aliasStr string) (*topodatapb.TabletAlias, error)

ParseTabletAlias returns a TabletAlias for the input string, of the form <cell>-<uid>

func ParseTabletType Uses

func ParseTabletType(param string) (topodatapb.TabletType, error)

ParseTabletType parses the tablet type into the enum.

func ParseTabletTypes Uses

func ParseTabletTypes(param string) ([]topodatapb.TabletType, error)

ParseTabletTypes parses a comma separated list of tablet types and returns a slice with the respective enums.

func ParseUID Uses

func ParseUID(value string) (uint32, error)

ParseUID parses just the uid (a number)

func SetMysqlPort Uses

func SetMysqlPort(tablet *topodatapb.Tablet, port int32)

SetMysqlPort sets the mysql port for tablet. This function also handles legacy by setting the port in PortMap. TODO(sougou); deprecate this function after 3.0.

func SourceShardAsHTML Uses

func SourceShardAsHTML(source *topodatapb.Shard_SourceShard) template.HTML

SourceShardAsHTML returns a HTML version of the object.

func SourceShardString Uses

func SourceShardString(source *topodatapb.Shard_SourceShard) string

SourceShardString returns a printable view of a SourceShard.

func SrvKeyspaceGetPartition Uses

func SrvKeyspaceGetPartition(sk *topodatapb.SrvKeyspace, tabletType topodatapb.TabletType) *topodatapb.SrvKeyspace_KeyspacePartition

SrvKeyspaceGetPartition returns a Partition for the given tablet type, or nil if it's not there.

func TabletAliasEqual Uses

func TabletAliasEqual(left, right *topodatapb.TabletAlias) bool

TabletAliasEqual returns true if two TabletAlias match

func TabletAliasIsZero Uses

func TabletAliasIsZero(ta *topodatapb.TabletAlias) bool

TabletAliasIsZero returns true iff cell and uid are empty

func TabletAliasString Uses

func TabletAliasString(ta *topodatapb.TabletAlias) string

TabletAliasString formats a TabletAlias

func TabletAliasUIDStr Uses

func TabletAliasUIDStr(ta *topodatapb.TabletAlias) string

TabletAliasUIDStr returns a string version of the uid

func TabletDbName Uses

func TabletDbName(tablet *topodatapb.Tablet) string

TabletDbName is usually implied by keyspace. Having the shard information in the database name complicates mysql replication.

func TabletIsAssigned Uses

func TabletIsAssigned(tablet *topodatapb.Tablet) bool

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.

func TabletTypeLString Uses

func TabletTypeLString(tabletType topodatapb.TabletType) string

TabletTypeLString returns a lower case version of the tablet type, or "unknown" if not known.

func TabletTypeListVar Uses

func TabletTypeListVar(p *[]topodatapb.TabletType, name string, usage string)

TabletTypeListVar defines a []TabletType flag with the specified name and usage string. The argument 'p' points to a []TabletType in which to store the value of the flag.

func TabletTypeVar Uses

func TabletTypeVar(p *topodatapb.TabletType, name string, defaultValue topodatapb.TabletType, usage string)

TabletTypeVar defines a TabletType flag with the specified name, default value and usage string. The argument 'p' points to a tabletType in which to store the value of the flag.

type ShardReferenceArray Uses

type ShardReferenceArray []*topodatapb.ShardReference

ShardReferenceArray is used for sorting ShardReference arrays

func (ShardReferenceArray) Len Uses

func (sra ShardReferenceArray) Len() int

Len implements sort.Interface

func (ShardReferenceArray) Less Uses

func (sra ShardReferenceArray) Less(i, j int) bool

Len implements sort.Interface

func (ShardReferenceArray) Sort Uses

func (sra ShardReferenceArray) Sort()

Sort will sort the list according to KeyRange.Start

func (ShardReferenceArray) Swap Uses

func (sra ShardReferenceArray) Swap(i, j int)

Len implements sort.Interface

type TabletAliasList Uses

type TabletAliasList []*topodatapb.TabletAlias

TabletAliasList is used mainly for sorting

func (TabletAliasList) Len Uses

func (tal TabletAliasList) Len() int

Len is part of sort.Interface

func (TabletAliasList) Less Uses

func (tal TabletAliasList) Less(i, j int) bool

Less is part of sort.Interface

func (TabletAliasList) Swap Uses

func (tal TabletAliasList) Swap(i, j int)

Swap is part of sort.Interface

type TabletTypeFlag Uses

type TabletTypeFlag topodatapb.TabletType

TabletTypeFlag implements the flag.Value interface, for parsing a command-line value into a TabletType.

func (*TabletTypeFlag) Get Uses

func (ttf *TabletTypeFlag) Get() interface{}

Get is for satisflying the internal flag interface.

func (*TabletTypeFlag) Set Uses

func (ttf *TabletTypeFlag) Set(v string) error

Set is part of the flag.Value interface.

func (*TabletTypeFlag) String Uses

func (ttf *TabletTypeFlag) String() string

String is part of the flag.Value interface.

type TabletTypeListValue Uses

type TabletTypeListValue []topodatapb.TabletType

TabletTypeListValue implements the flag.Value interface, for parsing a command-line comma-separated list of value into a slice of TabletTypes.

func (*TabletTypeListValue) Get Uses

func (ttlv *TabletTypeListValue) Get() interface{}

Get is for satisflying the internal flag interface.

func (*TabletTypeListValue) Set Uses

func (ttlv *TabletTypeListValue) Set(v string) (err error)

Set is part of the flag.Value interface.

func (*TabletTypeListValue) String Uses

func (ttlv *TabletTypeListValue) String() string

String is part of the flag.Value interface.

Package topoproto imports 14 packages (graph) and is imported by 47 packages. Updated 2019-06-13. Refresh now. Tools for package owners.