Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoStore is an empty NoStoreErr object, useful for type checking
	ErrNoStore = &NoStoreErr{}
)

Functions

This section is empty.

Types

type BinlogClient

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

BinlogClient is the client of binlog.

func NewBinlogClient

func NewBinlogClient(pdEndpoint []string, tlsConfig *tls.Config) (*BinlogClient, error)

NewBinlogClient create a BinlogClient.

func (*BinlogClient) IsDrainerTombstone

func (c *BinlogClient) IsDrainerTombstone(addr string) (bool, error)

IsDrainerTombstone check if drainer is tombstone.

func (*BinlogClient) IsPumpTombstone

func (c *BinlogClient) IsPumpTombstone(addr string) (bool, error)

IsPumpTombstone check if drainer is tombstone.

func (*BinlogClient) OfflineDrainer

func (c *BinlogClient) OfflineDrainer(addr string) error

OfflineDrainer offline a drainer.

func (*BinlogClient) OfflinePump

func (c *BinlogClient) OfflinePump(addr string) error

OfflinePump offline a pump.

func (*BinlogClient) UpdateDrainerState added in v1.0.8

func (c *BinlogClient) UpdateDrainerState(addr string, state string) error

UpdateDrainerState update the specify state as the specified state.

func (*BinlogClient) UpdatePumpState added in v1.0.8

func (c *BinlogClient) UpdatePumpState(addr string, state string) error

UpdatePumpState update the specify state as the specified state.

type DMMasterClient

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

DMMasterClient is an HTTP client of the dm-master server

func NewDMMasterClient

func NewDMMasterClient(addrs []string, timeout time.Duration, tlsConfig *tls.Config) *DMMasterClient

NewDMMasterClient returns a new PDClient

func (*DMMasterClient) EvictDMMasterLeader

func (dm *DMMasterClient) EvictDMMasterLeader(retryOpt *utils.RetryOption) error

EvictDMMasterLeader evicts the dm master leader

func (*DMMasterClient) GetLeader

func (dm *DMMasterClient) GetLeader(retryOpt *utils.RetryOption) (string, error)

GetLeader gets leader of dm cluster

func (*DMMasterClient) GetMaster

func (dm *DMMasterClient) GetMaster(name string) (isFound bool, isActive bool, isLeader bool, err error)

GetMaster returns the dm master leader returns isFound, isActive, isLeader, error

func (*DMMasterClient) GetRegisteredMembers

func (dm *DMMasterClient) GetRegisteredMembers() ([]string, []string, error)

GetRegisteredMembers gets all registerer members of dm cluster

func (*DMMasterClient) GetURL

func (dm *DMMasterClient) GetURL(addr string) string

GetURL builds the the client URL of DMClient

func (*DMMasterClient) GetWorker

func (dm *DMMasterClient) GetWorker(name string) (string, error)

GetWorker returns the dm worker status returns (worker stage, error). If worker stage is "", that means this worker is in cluster

func (*DMMasterClient) OfflineMaster

func (dm *DMMasterClient) OfflineMaster(name string, retryOpt *utils.RetryOption) error

OfflineMaster offlines the dm master

func (*DMMasterClient) OfflineMember

func (dm *DMMasterClient) OfflineMember(query string, retryOpt *utils.RetryOption) error

OfflineMember offlines the member of dm cluster

func (*DMMasterClient) OfflineWorker

func (dm *DMMasterClient) OfflineWorker(name string, retryOpt *utils.RetryOption) error

OfflineWorker offlines the dm worker

type NoStoreErr added in v1.3.1

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

NoStoreErr is the error that no store matching address can be found in PD

func (*NoStoreErr) Error added in v1.3.1

func (e *NoStoreErr) Error() string

Error implement the error interface

func (*NoStoreErr) Is added in v1.3.1

func (e *NoStoreErr) Is(target error) bool

Is implements the error interface

type NodeStatus

type NodeStatus struct {
	NodeID      string `json:"nodeId"`
	Addr        string `json:"host"`
	State       string `json:"state"`
	MaxCommitTS int64  `json:"maxCommitTS"`
	UpdateTS    int64  `json:"updateTS"`
}

NodeStatus represents the status saved in etcd.

type PDClient

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

PDClient is an HTTP client of the PD server

func NewPDClient

func NewPDClient(addrs []string, timeout time.Duration, tlsConfig *tls.Config) *PDClient

NewPDClient returns a new PDClient

func (*PDClient) CheckHealth added in v1.0.5

func (pc *PDClient) CheckHealth() error

CheckHealth checks the health of PD node

func (*PDClient) DelPD

func (pc *PDClient) DelPD(name string, retryOpt *utils.RetryOption) error

DelPD deletes a PD node from the cluster, name is the Name of the PD member

func (*PDClient) DelStore

func (pc *PDClient) DelStore(host string, retryOpt *utils.RetryOption) error

DelStore deletes stores from a (TiKV) host The host parameter should be in format of IP:Port, that matches store's address

func (*PDClient) EvictPDLeader

func (pc *PDClient) EvictPDLeader(retryOpt *utils.RetryOption) error

EvictPDLeader evicts the PD leader

func (*PDClient) EvictStoreLeader

func (pc *PDClient) EvictStoreLeader(host string, retryOpt *utils.RetryOption, countLeader func(string) (int, error)) error

EvictStoreLeader evicts the store leaders The host parameter should be in format of IP:Port, that matches store's address

func (*PDClient) GetCurrentStore added in v1.3.1

func (pc *PDClient) GetCurrentStore(addr string) (*pdserverapi.StoreInfo, error)

GetCurrentStore gets the current store info of a given host

func (*PDClient) GetDashboardAddress

func (pc *PDClient) GetDashboardAddress() (string, error)

GetDashboardAddress get the PD node address which runs dashboard

func (*PDClient) GetLeader

func (pc *PDClient) GetLeader() (*pdpb.Member, error)

GetLeader queries the leader node of PD cluster

func (*PDClient) GetLocationLabels added in v1.2.0

func (pc *PDClient) GetLocationLabels() ([]string, error)

GetLocationLabels gets the replication.location-labels config from pd server

func (*PDClient) GetMembers

func (pc *PDClient) GetMembers() (*pdpb.GetMembersResponse, error)

GetMembers queries for member list from the PD server

func (*PDClient) GetReplicateConfig

func (pc *PDClient) GetReplicateConfig() ([]byte, error)

GetReplicateConfig gets the PD replication config

func (*PDClient) GetStores

func (pc *PDClient) GetStores() (*pdserverapi.StoresInfo, error)

GetStores queries the stores info from PD server

func (*PDClient) GetTiKVLabels added in v1.2.3

func (pc *PDClient) GetTiKVLabels() (map[string]map[string]string, error)

GetTiKVLabels implements TiKVLabelProvider

func (*PDClient) GetURL

func (pc *PDClient) GetURL(addr string) string

GetURL builds the the client URL of PDClient

func (*PDClient) IsTombStone

func (pc *PDClient) IsTombStone(host string) (bool, error)

IsTombStone check if the node is Tombstone. The host parameter should be in format of IP:Port, that matches store's address

func (*PDClient) IsUp added in v1.0.2

func (pc *PDClient) IsUp(host string) (bool, error)

IsUp check if the node is Up state. The host parameter should be in format of IP:Port, that matches store's address

func (*PDClient) RemoveStoreEvict

func (pc *PDClient) RemoveStoreEvict(host string) error

RemoveStoreEvict removes a store leader evict scheduler, which allows following leaders to be transffered to it again.

func (*PDClient) UpdateReplicateConfig

func (pc *PDClient) UpdateReplicateConfig(body io.Reader) error

UpdateReplicateConfig updates the PD replication config

func (*PDClient) UpdateScheduleConfig added in v1.0.2

func (pc *PDClient) UpdateScheduleConfig(body io.Reader) error

UpdateScheduleConfig updates the PD schedule config

func (*PDClient) WaitLeader

func (pc *PDClient) WaitLeader(retryOpt *utils.RetryOption) error

WaitLeader wait until there's a leader or timeout.

type StatusResp

type StatusResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

StatusResp represents the response of status api.

Jump to

Keyboard shortcuts

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