tiflowapi

package
v1.0.0-20221102-166735... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

func GetTLSConfig

func GetTLSConfig(cli client.Client, namespace, secretName string) (*tls.Config, error)

GetTLSConfig returns *tls.Config for given TiDB cluster.

func LoadTlsConfigFromSecret

func LoadTlsConfigFromSecret(secret *corev1.Secret) (*tls.Config, error)

func MasterClientURL

func MasterClientURL(namespace, clusterName, podName, scheme string) string

MasterClientURL builds the url of master client

Types

type Executor

type Executor struct {
	ID         string `json:"id,omitempty"`
	Name       string `json:"name,omitempty"`
	Address    string `json:"address,omitempty"`
	Capability string `json:"capability,omitempty"`
}

type ExecutorsInfo

type ExecutorsInfo struct {
	Executors []*Executor `json:"executors,omitempty"`
}

type LeaderInfo

type LeaderInfo struct {
	AdvertiseAddr string `json:"advertise_addr,omitempty"`
}

type Master

type Master struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	Address  string `json:"address,omitempty"`
	IsLeader bool   `json:"is_leader,omitempty"`
}

type MasterClient

type MasterClient interface {
	// GetMasters returns all master members from cluster
	GetMasters() (MastersInfo, error)
	GetExecutors() (ExecutorsInfo, error)
	GetLeader() (LeaderInfo, error)
	GetURL() string
	EvictLeader() error
	DeleteMaster(name string) error
	DeleteExecutor(name string) error
}

MasterClient provides master server's api

func GetMasterClient

func GetMasterClient(cli client.Client, namespace, tcName, podName string, tlsEnabled bool) MasterClient

GetMasterClient provides a MasterClient of real tiflow-master cluster podName == "": get load balancer service of tiflow-master cluster podNAme != "": get exact pod's service of tiflow-master client

func NewMasterClient

func NewMasterClient(url string, timeout time.Duration, tlsConfig *tls.Config) MasterClient

NewMasterClient returns a new MasterClient

type MastersInfo

type MastersInfo struct {
	Masters []*Master `json:"masters,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL