infosync

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitEtcdClient

func InitEtcdClient(logger *zap.Logger, cfg *config.Config, certMgr *cert.CertManager) (*clientv3.Client, error)

InitEtcdClient initializes an etcd client that connects to PD ETCD server.

Types

type InfoSyncer

type InfoSyncer struct {
	// contains filtered or unexported fields
}

InfoSyncer syncs TiProxy topology to ETCD and queries TiDB topology from ETCD. It writes 2 items to ETCD: `/topology/tiproxy/.../info` and `/topology/tiproxy/.../ttl`. They are erased after TiProxy is down. The code is modified from github.com/pingcap/tidb/domain/infosync/info.go.

func NewInfoSyncer

func NewInfoSyncer(lg *zap.Logger) *InfoSyncer

func (*InfoSyncer) Close

func (is *InfoSyncer) Close() error

func (*InfoSyncer) GetTiDBTopology

func (is *InfoSyncer) GetTiDBTopology(ctx context.Context) (map[string]*TiDBInfo, error)

func (*InfoSyncer) Init

func (is *InfoSyncer) Init(ctx context.Context, cfg *config.Config, certMgr *cert.CertManager) error

type TiDBInfo

type TiDBInfo struct {
	// TopologyInfo is parsed from the /info path.
	*tidbinfo.TopologyInfo
	// TTL is parsed from the /ttl path.
	TTL string
}

TiDBInfo is the info of TiDB.

type TopologyInfo

type TopologyInfo struct {
	Version        string `json:"version"`
	GitHash        string `json:"git_hash"`
	IP             string `json:"ip"`
	Port           string `json:"port"`
	StatusPort     string `json:"status_port"`
	DeployPath     string `json:"deploy_path"`
	StartTimestamp int64  `json:"start_timestamp"`
}

TopologyInfo is the info of TiProxy.

Jump to

Keyboard shortcuts

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