Documentation
¶
Index ¶
- Variables
- func ParseBackendID(id string) (clusterName, addr string)
- type Cluster
- func (c *Cluster) Close() error
- func (c *Cluster) Config() config.BackendCluster
- func (c *Cluster) DialContext(ctx context.Context, network, addr string) (net.Conn, error)
- func (c *Cluster) EtcdClient() *clientv3.Client
- func (c *Cluster) GetPromInfo(ctx context.Context) (*infosync.PrometheusInfo, error)
- func (c *Cluster) GetTiDBTopology(ctx context.Context) (map[string]*infosync.TiDBTopologyInfo, error)
- func (c *Cluster) HTTPClient() *httputil.Client
- func (c *Cluster) PreClose()
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) GetTiDBTopology(ctx context.Context) (map[string]*infosync.TiDBTopologyInfo, error)
- func (m *Manager) HasBackendClusters() bool
- func (m *Manager) MetricsQuerier() *MetricsQuerier
- func (m *Manager) NetworkRouter() *NetworkRouter
- func (m *Manager) PreClose()
- func (m *Manager) PrimaryCluster() *Cluster
- func (m *Manager) Snapshot() map[string]*Cluster
- func (m *Manager) Start(ctx context.Context, cfgGetter config.ConfigGetter, ...) error
- type MetricsQuerier
- func (mq *MetricsQuerier) AddQueryExpr(key string, queryExpr metricsreader.QueryExpr, ...)
- func (mq *MetricsQuerier) GetBackendMetrics() []byte
- func (mq *MetricsQuerier) GetBackendMetricsByCluster(clusterName string) []byte
- func (mq *MetricsQuerier) GetQueryResult(key string) metricsreader.QueryResult
- func (mq *MetricsQuerier) RemoveQueryExpr(key string)
- type NetworkRouter
Constants ¶
This section is empty.
Variables ¶
var ErrBackendClusterNotFound = errors.New("backend cluster not found")
Functions ¶
func ParseBackendID ¶
ParseBackendID parses the backendID into clusterName and addr. Please avoid using this function as much as possible, and only use it when you cannot find any other way to get the clusterName and addr. The backendID is designed to be opaque and should not be parsed in most cases.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster is the cluster-scoped container for one backend PD cluster.
func NewCluster ¶
func NewCluster( ctx context.Context, cfg *config.Config, clusterCfg config.BackendCluster, clusterTLS func() *tls.Config, logger *zap.Logger, cfgGetter config.ConfigGetter, metricsQuerier *MetricsQuerier, ) (*Cluster, error)
NewCluster creates a new Cluster instance based on the given configuration.
func (*Cluster) Config ¶
func (c *Cluster) Config() config.BackendCluster
func (*Cluster) DialContext ¶
func (*Cluster) EtcdClient ¶
func (*Cluster) GetPromInfo ¶
func (*Cluster) GetTiDBTopology ¶
func (*Cluster) HTTPClient ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) GetTiDBTopology ¶
func (*Manager) HasBackendClusters ¶
func (*Manager) MetricsQuerier ¶
func (m *Manager) MetricsQuerier() *MetricsQuerier
func (*Manager) NetworkRouter ¶
func (m *Manager) NetworkRouter() *NetworkRouter
func (*Manager) PrimaryCluster ¶
PrimaryCluster returns the only configured cluster when the cluster count is exactly one. It exists for features that are only well-defined in the single-cluster case, such as VIP.
type MetricsQuerier ¶
type MetricsQuerier struct {
// contains filtered or unexported fields
}
MetricsQuerier is a thin fan-out and merge view over cluster-scoped metrics readers. It does not own any metrics collection lifecycle by itself.
func NewMetricsQuerier ¶
func NewMetricsQuerier(manager *Manager) *MetricsQuerier
func (*MetricsQuerier) AddQueryExpr ¶
func (mq *MetricsQuerier) AddQueryExpr(key string, queryExpr metricsreader.QueryExpr, queryRule metricsreader.QueryRule)
func (*MetricsQuerier) GetBackendMetrics ¶
func (mq *MetricsQuerier) GetBackendMetrics() []byte
func (*MetricsQuerier) GetBackendMetricsByCluster ¶
func (mq *MetricsQuerier) GetBackendMetricsByCluster(clusterName string) []byte
func (*MetricsQuerier) GetQueryResult ¶
func (mq *MetricsQuerier) GetQueryResult(key string) metricsreader.QueryResult
func (*MetricsQuerier) RemoveQueryExpr ¶
func (mq *MetricsQuerier) RemoveQueryExpr(key string)
type NetworkRouter ¶
type NetworkRouter struct {
// contains filtered or unexported fields
}
NetworkRouter is a thin dispatch view over cluster-scoped dialers and HTTP clients. It does not own any cluster lifecycle by itself.
func NewNetworkRouter ¶
func NewNetworkRouter(manager *Manager, clusterTLS func() *tls.Config) *NetworkRouter
func (*NetworkRouter) DialContext ¶
func (*NetworkRouter) HTTPClient ¶
func (nr *NetworkRouter) HTTPClient(clusterName string) *httputil.Client