pdapi

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: 22 Imported by: 0

Documentation

Overview

Package pdapi is a generated GoMock package.

Index

Constants

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

Variables

This section is empty.

Functions

func IsTiKVNotBootstrappedError

func IsTiKVNotBootstrappedError(err error) bool

IsTiKVNotBootstrappedError returns whether err is a TiKVNotBootstrappedError.

func TiKVNotBootstrappedErrorf

func TiKVNotBootstrappedErrorf(format string, a ...any) error

TiKVNotBootstrappedErrorf returns a TiKVNotBootstrappedError.

Types

type EvictLeaderSchedulerConfig

type EvictLeaderSchedulerConfig struct {
	StoreIDWithRanges map[uint64]json.RawMessage `json:"store-id-ranges"`
}

EvictLeaderSchedulerConfig holds configuration for evict leader https://github.com/pingcap/pd/blob/b21855a3aeb787c71b0819743059e432be217dcd/server/schedulers/evict_leader.go#L81-L86 note that we use `json.RawMessage` as the type of value because we don't care about the value for now

type FileLogConfig

type FileLogConfig struct {
	// Log filename, leave empty to disable file log.
	Filename string `toml:"filename,omitempty" json:"filename,omitempty"`
	// Is log rotate enabled.
	LogRotate bool `toml:"log-rotate,omitempty" json:"log-rotate,omitempty"`
	// Max size for a single file, in MB.
	MaxSize int `toml:"max-size,omitempty" json:"max-size,omitempty"`
	// Max log keep days, default is never deleting.
	MaxDays int `toml:"max-days,omitempty" json:"max-days,omitempty"`
	// Maximum number of old log files to retain.
	MaxBackups int `toml:"max-backups,omitempty" json:"max-backups,omitempty"`
}

FileLogConfig is the configuration for file log. +k8s:openapi-gen=true

type HealthInfo

type HealthInfo struct {
	Healths []MemberHealth
}

HealthInfo define PD's healthy info.

type KeyValue

type KeyValue struct {
	Key   string
	Value []byte
}

type MemberHealth

type MemberHealth struct {
	Name       string   `json:"name"`
	MemberID   uint64   `json:"member_id"`
	ClientUrls []string `json:"client_urls"`
	Health     bool     `json:"health"`
}

MemberHealth define a PD member's healthy info.

type MembersInfo

type MembersInfo struct {
	Header     *pdpb.ResponseHeader `json:"header,omitempty"`
	Members    []*pdpb.Member       `json:"members,omitempty"`
	Leader     *pdpb.Member         `json:"leader,omitempty"`
	EtcdLeader *pdpb.Member         `json:"etcd_leader,omitempty"`
}

MembersInfo is PD members info returned from PD RESTful interface.

type MetaStore

type MetaStore struct {
	*metapb.Store
	StateName string `json:"state_name"`
}

MetaStore is TiKV store status defined in protobuf.

type MockPDClient

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

MockPDClient is a mock of PDClient interface.

func NewMockPDClient

func NewMockPDClient(ctrl *gomock.Controller) *MockPDClient

NewMockPDClient creates a new mock instance.

func (*MockPDClient) BeginEvictLeader

func (m *MockPDClient) BeginEvictLeader(ctx context.Context, storeID string) error

BeginEvictLeader mocks base method.

func (*MockPDClient) CancelDeleteStore

func (m *MockPDClient) CancelDeleteStore(ctx context.Context, storeID string) error

CancelDeleteStore mocks base method.

func (*MockPDClient) DeleteMember

func (m *MockPDClient) DeleteMember(ctx context.Context, name string) error

DeleteMember mocks base method.

func (*MockPDClient) DeleteStore

func (m *MockPDClient) DeleteStore(ctx context.Context, storeID string) error

DeleteStore mocks base method.

func (*MockPDClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPDClient) EndEvictLeader

func (m *MockPDClient) EndEvictLeader(ctx context.Context, storeID string) error

EndEvictLeader mocks base method.

func (*MockPDClient) GetCluster

func (m *MockPDClient) GetCluster(ctx context.Context) (*metapb.Cluster, error)

GetCluster mocks base method.

func (*MockPDClient) GetConfig

func (m *MockPDClient) GetConfig(ctx context.Context) (*PDConfigFromAPI, error)

GetConfig mocks base method.

func (*MockPDClient) GetEvictLeaderScheduler

func (m *MockPDClient) GetEvictLeaderScheduler(ctx context.Context, storeID string) (string, error)

GetEvictLeaderScheduler mocks base method.

func (*MockPDClient) GetHealth

func (m *MockPDClient) GetHealth(ctx context.Context) (*HealthInfo, error)

GetHealth mocks base method.

func (*MockPDClient) GetMemberReady

func (m *MockPDClient) GetMemberReady(ctx context.Context, url, version string) (bool, error)

GetMemberReady mocks base method.

func (*MockPDClient) GetMembers

func (m *MockPDClient) GetMembers(ctx context.Context) (*MembersInfo, error)

GetMembers mocks base method.

func (*MockPDClient) GetPDEtcdClient

func (m *MockPDClient) GetPDEtcdClient() (PDEtcdClient, error)

GetPDEtcdClient mocks base method.

func (*MockPDClient) GetStore

func (m *MockPDClient) GetStore(ctx context.Context, storeID string) (*StoreInfo, error)

GetStore mocks base method.

func (*MockPDClient) GetStores

func (m *MockPDClient) GetStores(ctx context.Context) (*StoresInfo, error)

GetStores mocks base method.

func (*MockPDClient) GetTSOLeader

func (m *MockPDClient) GetTSOLeader(ctx context.Context) (string, error)

GetTSOLeader mocks base method.

func (*MockPDClient) GetTSOMembers

func (m *MockPDClient) GetTSOMembers(ctx context.Context) ([]ServiceRegistryEntry, error)

GetTSOMembers mocks base method.

func (*MockPDClient) SetStoreLabels

func (m *MockPDClient) SetStoreLabels(ctx context.Context, storeID uint64, labels map[string]string) (bool, error)

SetStoreLabels mocks base method.

func (*MockPDClient) TransferPDLeader

func (m *MockPDClient) TransferPDLeader(ctx context.Context, name string) error

TransferPDLeader mocks base method.

type MockPDClientMockRecorder

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

MockPDClientMockRecorder is the mock recorder for MockPDClient.

func (*MockPDClientMockRecorder) BeginEvictLeader

func (mr *MockPDClientMockRecorder) BeginEvictLeader(ctx, storeID any) *gomock.Call

BeginEvictLeader indicates an expected call of BeginEvictLeader.

func (*MockPDClientMockRecorder) CancelDeleteStore

func (mr *MockPDClientMockRecorder) CancelDeleteStore(ctx, storeID any) *gomock.Call

CancelDeleteStore indicates an expected call of CancelDeleteStore.

func (*MockPDClientMockRecorder) DeleteMember

func (mr *MockPDClientMockRecorder) DeleteMember(ctx, name any) *gomock.Call

DeleteMember indicates an expected call of DeleteMember.

func (*MockPDClientMockRecorder) DeleteStore

func (mr *MockPDClientMockRecorder) DeleteStore(ctx, storeID any) *gomock.Call

DeleteStore indicates an expected call of DeleteStore.

func (*MockPDClientMockRecorder) EndEvictLeader

func (mr *MockPDClientMockRecorder) EndEvictLeader(ctx, storeID any) *gomock.Call

EndEvictLeader indicates an expected call of EndEvictLeader.

func (*MockPDClientMockRecorder) GetCluster

func (mr *MockPDClientMockRecorder) GetCluster(ctx any) *gomock.Call

GetCluster indicates an expected call of GetCluster.

func (*MockPDClientMockRecorder) GetConfig

func (mr *MockPDClientMockRecorder) GetConfig(ctx any) *gomock.Call

GetConfig indicates an expected call of GetConfig.

func (*MockPDClientMockRecorder) GetEvictLeaderScheduler

func (mr *MockPDClientMockRecorder) GetEvictLeaderScheduler(ctx, storeID any) *gomock.Call

GetEvictLeaderScheduler indicates an expected call of GetEvictLeaderScheduler.

func (*MockPDClientMockRecorder) GetHealth

func (mr *MockPDClientMockRecorder) GetHealth(ctx any) *gomock.Call

GetHealth indicates an expected call of GetHealth.

func (*MockPDClientMockRecorder) GetMemberReady

func (mr *MockPDClientMockRecorder) GetMemberReady(ctx, url, version any) *gomock.Call

GetMemberReady indicates an expected call of GetMemberReady.

func (*MockPDClientMockRecorder) GetMembers

func (mr *MockPDClientMockRecorder) GetMembers(ctx any) *gomock.Call

GetMembers indicates an expected call of GetMembers.

func (*MockPDClientMockRecorder) GetPDEtcdClient

func (mr *MockPDClientMockRecorder) GetPDEtcdClient() *gomock.Call

GetPDEtcdClient indicates an expected call of GetPDEtcdClient.

func (*MockPDClientMockRecorder) GetStore

func (mr *MockPDClientMockRecorder) GetStore(ctx, storeID any) *gomock.Call

GetStore indicates an expected call of GetStore.

func (*MockPDClientMockRecorder) GetStores

func (mr *MockPDClientMockRecorder) GetStores(ctx any) *gomock.Call

GetStores indicates an expected call of GetStores.

func (*MockPDClientMockRecorder) GetTSOLeader

func (mr *MockPDClientMockRecorder) GetTSOLeader(ctx any) *gomock.Call

GetTSOLeader indicates an expected call of GetTSOLeader.

func (*MockPDClientMockRecorder) GetTSOMembers

func (mr *MockPDClientMockRecorder) GetTSOMembers(ctx any) *gomock.Call

GetTSOMembers indicates an expected call of GetTSOMembers.

func (*MockPDClientMockRecorder) SetStoreLabels

func (mr *MockPDClientMockRecorder) SetStoreLabels(ctx, storeID, labels any) *gomock.Call

SetStoreLabels indicates an expected call of SetStoreLabels.

func (*MockPDClientMockRecorder) TransferPDLeader

func (mr *MockPDClientMockRecorder) TransferPDLeader(ctx, name any) *gomock.Call

TransferPDLeader indicates an expected call of TransferPDLeader.

type Namespace

type Namespace string

Namespace is a newtype of a string

type PDClient

type PDClient interface {
	// GetMemberReady returns if a PD member is ready to serve.
	// In order to call this method, the PD member's URL is required.
	GetMemberReady(ctx context.Context, url, version string) (bool, error)
	// GetHealth returns the health of PD's members.
	GetHealth(ctx context.Context) (*HealthInfo, error)
	// GetConfig returns PD's config.
	GetConfig(ctx context.Context) (*PDConfigFromAPI, error)
	// GetCluster returns the cluster information.
	GetCluster(ctx context.Context) (*metapb.Cluster, error)
	// GetMembers returns all PD members of the cluster.
	GetMembers(ctx context.Context) (*MembersInfo, error)
	// GetStores lists all TiKV/TiFlash stores of the cluster.
	GetStores(ctx context.Context) (*StoresInfo, error)
	// GetTombStoneStores lists all tombstone stores of the cluster.
	// GetTombStoneStores() (*StoresInfo, error)
	// GetStore gets a TiKV/TiFlash store for a specific store id of the cluster.
	GetStore(ctx context.Context, storeID string) (*StoreInfo, error)
	// GetEvictLeaderScheduler gets leader eviction schedulers for stores.
	GetEvictLeaderScheduler(ctx context.Context, storeID string) (string, error)

	GetPDEtcdClient() (PDEtcdClient, error)

	GetTSOLeader(ctx context.Context) (string, error)

	// GetTSOMembers returns all PD members service-addr from cluster by specific Micro Service.
	GetTSOMembers(ctx context.Context) ([]ServiceRegistryEntry, error)

	PDWriter
}

PDClient provides PD server's APIs used by TiDB Operator.

func NewPDClient

func NewPDClient(url string, timeout time.Duration, tlsConfig *tls.Config) PDClient

NewPDClient returns a new PDClient

type PDConfigFromAPI

type PDConfigFromAPI struct {
	// Log related config.
	Log *PDLogConfig `toml:"log,omitempty" json:"log,omitempty"`

	// Immutable, change should be made through pd-ctl after cluster creation
	Schedule *PDScheduleConfig `toml:"schedule,omitempty" json:"schedule,omitempty"`

	// Immutable, change should be made through pd-ctl after cluster creation
	Replication *PDReplicationConfig `toml:"replication,omitempty" json:"replication,omitempty"`
}

PDConfigFromAPI is the configuration from PD API +k8s:openapi-gen=true

type PDEtcdClient

type PDEtcdClient interface {
	// Get the specific kvs.
	// if prefix is true will return all kvs with the specified key as prefix
	Get(key string, prefix bool) (kvs []*KeyValue, err error)
	// PutKey will put key to the target pd etcd cluster
	PutKey(key, value string) error
	// PutKey will put key with ttl to the target pd etcd cluster
	PutTTLKey(key, value string, ttl int64) error
	// DeleteKey will delete key from the target pd etcd cluster
	DeleteKey(key string) error
	// Close will close the etcd connection
	Close() error
}

func NewPdEtcdClient

func NewPdEtcdClient(url string, timeout time.Duration, tlsConfig *tls.Config) (PDEtcdClient, error)

type PDLogConfig

type PDLogConfig struct {
	// Log level.
	// Optional: Defaults to info
	Level string `toml:"level,omitempty" json:"level,omitempty"`
	// Log format. one of json, text, or console.
	Format string `toml:"format,omitempty" json:"format,omitempty"`
	// Disable automatic timestamps in output.
	DisableTimestamp *bool `toml:"disable-timestamp,omitempty" json:"disable-timestamp,omitempty"`
	// File log config.
	File *FileLogConfig `toml:"file,omitempty" json:"file,omitempty"`
	// Development puts the logger in development mode, which changes the
	// behavior of DPanicLevel and takes stacktraces more liberally.
	Development *bool `toml:"development,omitempty" json:"development,omitempty"`
	// DisableCaller stops annotating logs with the calling function's file
	// name and line number. By default, all logs are annotated.
	DisableCaller *bool `toml:"disable-caller,omitempty" json:"disable-caller,omitempty"`
	// DisableStacktrace completely disables automatic stacktrace capturing. By
	// default, stacktraces are captured for WarnLevel and above logs in
	// development and ErrorLevel and above in production.
	DisableStacktrace *bool `toml:"disable-stacktrace,omitempty" json:"disable-stacktrace,omitempty"`
	// DisableErrorVerbose stops annotating logs with the full verbose error
	// message.
	DisableErrorVerbose *bool `toml:"disable-error-verbose,omitempty" json:"disable-error-verbose,omitempty"`
}

PDLogConfig serializes log related config in toml/json. +k8s:openapi-gen=true

type PDReplicationConfig

type PDReplicationConfig struct {
	// MaxReplicas is the number of replicas for each region.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 3
	MaxReplicas *uint64 `toml:"max-replicas,omitempty" json:"max-replicas,omitempty"`

	// The label keys specified the location of a store.
	// The placement priorities is implied by the order of label keys.
	// For example, ["zone", "rack"] means that we should place replicas to
	// different zones first, then to different racks if we don't have enough zones.
	// Immutable, change should be made through pd-ctl after cluster creation
	// +k8s:openapi-gen=false
	LocationLabels StringSlice `toml:"location-labels,omitempty" json:"location-labels,omitempty"`
	// StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocaltionLabels.
	// Immutable, change should be made through pd-ctl after cluster creation.
	// Imported from v3.1.0
	StrictlyMatchLabel *bool `toml:"strictly-match-label,omitempty" json:"strictly-match-label,string,omitempty"`

	// When PlacementRules feature is enabled. MaxReplicas and LocationLabels are not used anymore.
	EnablePlacementRules *bool `toml:"enable-placement-rules" json:"enable-placement-rules,string,omitempty"`
}

PDReplicationConfig is the replication configuration. +k8s:openapi-gen=true

type PDScheduleConfig

type PDScheduleConfig struct {
	// If the snapshot count of one store is greater than this value,
	// it will never be used as a source or target store.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 3
	MaxSnapshotCount *uint64 `toml:"max-snapshot-count,omitempty" json:"max-snapshot-count,omitempty"`
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 16
	MaxPendingPeerCount *uint64 `toml:"max-pending-peer-count,omitempty" json:"max-pending-peer-count,omitempty"`
	// If both the size of region is smaller than MaxMergeRegionSize
	// and the number of rows in region is smaller than MaxMergeRegionKeys,
	// it will try to merge with adjacent regions.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 20
	MaxMergeRegionSize *uint64 `toml:"max-merge-region-size,omitempty" json:"max-merge-region-size,omitempty"`
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 200000
	MaxMergeRegionKeys *uint64 `toml:"max-merge-region-keys,omitempty" json:"max-merge-region-keys,omitempty"`
	// SplitMergeInterval is the minimum interval time to permit merge after split.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 1h
	SplitMergeInterval string `toml:"split-merge-interval,omitempty" json:"split-merge-interval,omitempty"`
	// PatrolRegionInterval is the interval for scanning region during patrol.
	// Immutable, change should be made through pd-ctl after cluster creation
	PatrolRegionInterval string `toml:"patrol-region-interval,omitempty" json:"patrol-region-interval,omitempty"`
	// MaxStoreDownTime is the max duration after which
	// a store will be considered to be down if it hasn't reported heartbeats.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 30m
	MaxStoreDownTime string `toml:"max-store-down-time,omitempty" json:"max-store-down-time,omitempty"`
	// LeaderScheduleLimit is the max coexist leader schedules.
	// Immutable, change should be made through pd-ctl after cluster creation.
	// Optional: Defaults to 4.
	// Imported from v3.1.0
	LeaderScheduleLimit *uint64 `toml:"leader-schedule-limit,omitempty" json:"leader-schedule-limit,omitempty"`
	// RegionScheduleLimit is the max coexist region schedules.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 2048
	RegionScheduleLimit *uint64 `toml:"region-schedule-limit,omitempty" json:"region-schedule-limit,omitempty"`
	// ReplicaScheduleLimit is the max coexist replica schedules.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 64
	ReplicaScheduleLimit *uint64 `toml:"replica-schedule-limit,omitempty" json:"replica-schedule-limit,omitempty"`
	// MergeScheduleLimit is the max coexist merge schedules.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 8
	MergeScheduleLimit *uint64 `toml:"merge-schedule-limit,omitempty" json:"merge-schedule-limit,omitempty"`
	// HotRegionScheduleLimit is the max coexist hot region schedules.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 4
	HotRegionScheduleLimit *uint64 `toml:"hot-region-schedule-limit,omitempty" json:"hot-region-schedule-limit,omitempty"`
	// HotRegionCacheHitThreshold is the cache hits threshold of the hot region.
	// If the number of times a region hits the hot cache is greater than this
	// threshold, it is considered a hot region.
	// Immutable, change should be made through pd-ctl after cluster creation
	HotRegionCacheHitsThreshold *uint64 `toml:"hot-region-cache-hits-threshold,omitempty" json:"hot-region-cache-hits-threshold,omitempty"`
	// TolerantSizeRatio is the ratio of buffer size for balance scheduler.
	// Immutable, change should be made through pd-ctl after cluster creation.
	// Imported from v3.1.0
	TolerantSizeRatio *float64 `toml:"tolerant-size-ratio,omitempty" json:"tolerant-size-ratio,omitempty"`
	//
	//      high space stage         transition stage           low space stage
	//   |--------------------|-----------------------------|-------------------------|
	//   ^                    ^                             ^                         ^
	//   0       HighSpaceRatio * capacity       LowSpaceRatio * capacity          capacity
	//
	// LowSpaceRatio is the lowest usage ratio of store which regraded as low space.
	// When in low space, store region score increases to very large and varies inversely with available size.
	// Immutable, change should be made through pd-ctl after cluster creation
	LowSpaceRatio *float64 `toml:"low-space-ratio,omitempty" json:"low-space-ratio,omitempty"`
	// HighSpaceRatio is the highest usage ratio of store which regraded as high space.
	// High space means there is a lot of spare capacity, and store region score varies directly with used size.
	// Immutable, change should be made through pd-ctl after cluster creation
	HighSpaceRatio *float64 `toml:"high-space-ratio,omitempty" json:"high-space-ratio,omitempty"`
	// DisableLearner is the option to disable using AddLearnerNode instead of AddNode
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableLearner *bool `toml:"disable-raft-learner,omitempty" json:"disable-raft-learner,string,omitempty"`

	// DisableRemoveDownReplica is the option to prevent replica checker from
	// removing down replicas.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableRemoveDownReplica *bool `toml:"disable-remove-down-replica,omitempty" json:"disable-remove-down-replica,string,omitempty"`
	// DisableReplaceOfflineReplica is the option to prevent replica checker from
	// repalcing offline replicas.
	// Immutable, change should be made through pd-ctl after cluster creation
	//nolint:lll // too long name
	DisableReplaceOfflineReplica *bool `toml:"disable-replace-offline-replica,omitempty" json:"disable-replace-offline-replica,string,omitempty"`
	// DisableMakeUpReplica is the option to prevent replica checker from making up
	// replicas when replica count is less than expected.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableMakeUpReplica *bool `toml:"disable-make-up-replica,omitempty" json:"disable-make-up-replica,string,omitempty"`
	// DisableRemoveExtraReplica is the option to prevent replica checker from
	// removing extra replicas.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableRemoveExtraReplica *bool `toml:"disable-remove-extra-replica,omitempty" json:"disable-remove-extra-replica,string,omitempty"`
	// DisableLocationReplacement is the option to prevent replica checker from
	// moving replica to a better location.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableLocationReplacement *bool `toml:"disable-location-replacement,omitempty" json:"disable-location-replacement,string,omitempty"`
	// DisableNamespaceRelocation is the option to prevent namespace checker
	// from moving replica to the target namespace.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableNamespaceRelocation *bool `toml:"disable-namespace-relocation,omitempty" json:"disable-namespace-relocation,string,omitempty"`

	// Schedulers support for loding customized schedulers
	// Immutable, change should be made through pd-ctl after cluster creation
	// json v2 is for the sake of compatible upgrade
	Schedulers *PDSchedulerConfigs `toml:"schedulers,omitempty" json:"schedulers-v2,omitempty"`

	// Only used to display
	SchedulersPayload map[string]any `toml:"schedulers-payload" json:"schedulers-payload,omitempty"`

	// EnableOneWayMerge is the option to enable one way merge. This means a Region can only be merged into the next region of it.
	// Imported from v3.1.0
	EnableOneWayMerge *bool `toml:"enable-one-way-merge" json:"enable-one-way-merge,string,omitempty"`
	// EnableCrossTableMerge is the option to enable cross table merge. This means two Regions can be merged with different table IDs.
	// This option only works when key type is "table".
	// Imported from v3.1.0
	EnableCrossTableMerge *bool `toml:"enable-cross-table-merge" json:"enable-cross-table-merge,string,omitempty"`
}

PDScheduleConfig is the schedule configuration. +k8s:openapi-gen=true

type PDSchedulerConfig

type PDSchedulerConfig struct {
	// Immutable, change should be made through pd-ctl after cluster creation
	Type string `toml:"type,omitempty" json:"type,omitempty"`
	// Immutable, change should be made through pd-ctl after cluster creation
	Args []string `toml:"args,omitempty" json:"args,omitempty"`
	// Immutable, change should be made through pd-ctl after cluster creation
	Disable *bool `toml:"disable,omitempty" json:"disable,omitempty"`
}

PDSchedulerConfig is customized scheduler configuration +k8s:openapi-gen=true

type PDSchedulerConfigs

type PDSchedulerConfigs []PDSchedulerConfig

type PDWriter

type PDWriter interface {
	// SetStoreLabels sets the labels for a store.
	SetStoreLabels(ctx context.Context, storeID uint64, labels map[string]string) (bool, error)
	// DeleteStore deletes a TiKV/TiFlash store from the cluster.
	DeleteStore(ctx context.Context, storeID string) error
	// CancelDeleteStore cancels the deletion of a TiKV/TiFlash store, returning it to online state.
	// If the store is already online, it will return nil.
	CancelDeleteStore(ctx context.Context, storeID string) error
	// DeleteMember deletes a PD member from the cluster.
	DeleteMember(ctx context.Context, name string) error

	// BeginEvictLeader initiates leader eviction for a store.
	BeginEvictLeader(ctx context.Context, storeID string) error
	// EndEvictLeader removes the leader eviction scheduler for a store.
	EndEvictLeader(ctx context.Context, storeID string) error

	// TransferPDLeader transfers PD leader to specified member.
	TransferPDLeader(ctx context.Context, name string) error
}

PDWriter defines write api call of pd TODO: move all Get api call to PDClient

type SchedulerInfo

type SchedulerInfo struct {
	Name    string `json:"name"`
	StoreID uint64 `json:"store_id"`
}

SchedulerInfo is a single scheduler info returned from PD RESTful interface.

type ServiceRegistryEntry

type ServiceRegistryEntry struct {
	Name           string `json:"name"`
	ServiceAddr    string `json:"service-addr"`
	Version        string `json:"version"`
	GitHash        string `json:"git-hash"`
	DeployPath     string `json:"deploy-path"`
	StartTimestamp int64  `json:"start-timestamp"`
}

ServiceRegistryEntry is the registry entry of PD Micro Service.

type StoreInfo

type StoreInfo struct {
	Store  *MetaStore   `json:"store"`
	Status *StoreStatus `json:"status"`
}

StoreInfo is a single store info returned from PD RESTful interface.

type StoreStatus

type StoreStatus struct {
	Capacity           pd.ByteSize `json:"capacity"`
	Available          pd.ByteSize `json:"available"`
	LeaderCount        int         `json:"leader_count"`
	RegionCount        int         `json:"region_count"`
	SendingSnapCount   uint32      `json:"sending_snap_count"`
	ReceivingSnapCount uint32      `json:"receiving_snap_count"`
	ApplyingSnapCount  uint32      `json:"applying_snap_count"`
	IsBusy             bool        `json:"is_busy"`

	StartTS         time.Time   `json:"start_ts"`
	LastHeartbeatTS time.Time   `json:"last_heartbeat_ts"`
	Uptime          pd.Duration `json:"uptime"`
}

StoreStatus is TiKV store status returned from PD RESTful interface.

type StoresInfo

type StoresInfo struct {
	Count  int          `json:"count"`
	Stores []*StoreInfo `json:"stores"`
}

StoresInfo is stores info returned from PD RESTful interface

type StringSlice

type StringSlice []string

StringSlice is more friendly to json encode/decode

func (StringSlice) MarshalJSON

func (s StringSlice) MarshalJSON() ([]byte, error)

MarshalJSON returns the size as a JSON string.

func (*StringSlice) UnmarshalJSON

func (s *StringSlice) UnmarshalJSON(text []byte) error

UnmarshalJSON parses a JSON string into the bytesize.

type TiKVNotBootstrappedError

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

TiKVNotBootstrappedError represents that TiKV cluster is not bootstrapped yet.

func (*TiKVNotBootstrappedError) Error

func (e *TiKVNotBootstrappedError) Error() string

Jump to

Keyboard shortcuts

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