tidbapi

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivateRequest

type ActivateRequest struct {
	KeyspaceName   string `json:"keyspace_name"`
	MaxIdleSeconds uint   `json:"max_idle_seconds"`

	// analyze table
	RunAutoAnalyze bool `json:"run_auto_analyze"`

	// DDL
	TiDBEnableDDL bool `json:"tidb_enable_ddl"`
}

type PoolState

type PoolState string
const (
	PoolStateActivated PoolState = "activated"
	PoolStateStandBy   PoolState = "standby"
)

type PoolStatus

type PoolStatus struct {
	State PoolState `json:"state"`
}

type ServerInfo

type ServerInfo struct {
	IsOwner bool `json:"is_owner"`
}

ServerInfo is the information of a TiDB server. ref https://github.com/pingcap/tidb/blob/v8.1.0/pkg/server/handler/tikvhandler/tikv_handler.go#L1696

type TiDBClient

type TiDBClient interface {
	// GetHealth gets the health status of this TiDB server.
	GetHealth(ctx context.Context) (bool, error)
	// GetInfo gets the information of this TiDB server.
	GetInfo(ctx context.Context) (*ServerInfo, error)
	// SetServerLabels sets the labels of this TiDB server.
	SetServerLabels(ctx context.Context, labels map[string]string) error

	// GetPoolStatus get the tidb pool status(standby or activated) of the tidb
	GetPoolStatus(ctx context.Context) (*PoolStatus, error)
	// Activate sets the keyspace of a standby TiDB instance.
	Activate(ctx context.Context, keyspace string) error
}

TiDBClient provides TiDB server's APIs used by TiDB Operator.

func NewTiDBClient

func NewTiDBClient(url string, timeout time.Duration, tlsConfig *tls.Config) TiDBClient

NewTiDBClient returns a new TiDBClient.

Jump to

Keyboard shortcuts

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