server

package
v4.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CorePath the core group, is at REST path `/pd/api/v1`.
	CorePath = "/pd/api/v1"
	// ExtensionsPath the named groups are REST at `/pd/apis/{GROUP_NAME}/{Version}`.
	ExtensionsPath = "/pd/apis"
)

Variables

View Source
var (
	// ErrNotLeader is returned when current server is not the leader and not possible to process request.
	// TODO: work as proxy.
	ErrNotLeader  = status.Errorf(codes.Unavailable, "not leader")
	ErrNotStarted = status.Errorf(codes.Unavailable, "server not started")
)

gRPC errors

View Source
var (
	// SchedulerConfigHandlerPath is the api router path of the schedule config handler.
	SchedulerConfigHandlerPath = "/api/v1/scheduler-config"

	// ErrServerNotStarted is error info for server not started.
	ErrServerNotStarted = errors.New("The server has not been started")
	// ErrOperatorNotFound is error info for operator not found.
	ErrOperatorNotFound = errors.New("operator not found")
	// ErrAddOperator is error info for already have an operator when adding operator.
	ErrAddOperator = errors.New("failed to add operator, maybe already have one")
	// ErrRegionNotAdjacent is error info for region not adjacent.
	ErrRegionNotAdjacent = errors.New("two regions are not adjacent")
	// ErrRegionNotFound is error info for region not found.
	ErrRegionNotFound = func(regionID uint64) error {
		return errors.Errorf("region %v not found", regionID)
	}
	// ErrRegionAbnormalPeer is error info for region has abonormal peer.
	ErrRegionAbnormalPeer = func(regionID uint64) error {
		return errors.Errorf("region %v has abnormal peer", regionID)
	}
	// ErrStoreNotFound is error info for store not found.
	ErrStoreNotFound = func(storeID uint64) error {
		return errors.Errorf("store %v not found", storeID)
	}
	// ErrPluginNotFound is error info for plugin not found.
	ErrPluginNotFound = func(pluginPath string) error {
		return errors.Errorf("plugin is not found: %s", pluginPath)
	}
)
View Source
var (
	// EnableZap enable the zap logger in embed etcd.
	EnableZap = false
	// EtcdStartTimeout the timeout of the startup etcd.
	EtcdStartTimeout = time.Minute * 5
)

Functions

func CheckPDVersion

func CheckPDVersion(opt *config.PersistOptions)

CheckPDVersion checks if PD needs to be upgraded.

func LogPDInfo

func LogPDInfo()

LogPDInfo prints the PD version information.

func NewTestMultiConfig

func NewTestMultiConfig(c *check.C, count int) []*config.Config

NewTestMultiConfig is only for test to create multiple pd configurations. Because PD client also needs this, so export here.

func NewTestServer

func NewTestServer(c *check.C) (*Server, CleanupFunc, error)

NewTestServer creates a pd server for testing.

func NewTestSingleConfig

func NewTestSingleConfig(c *check.C) *config.Config

NewTestSingleConfig is only for test to create one pd. Because PD client also needs this, so export here.

func PrintConfigCheckMsg

func PrintConfigCheckMsg(cfg *config.Config)

PrintConfigCheckMsg prints the message about configuration checks.

func PrintPDInfo

func PrintPDInfo()

PrintPDInfo prints the PD version information without log info.

func StartMonitor

func StartMonitor(ctx context.Context, now func() time.Time, systimeErrHandler func())

StartMonitor calls systimeErrHandler if system time jump backward.

Types

type CleanupFunc

type CleanupFunc func()

CleanupFunc closes test pd server(s) and deletes any files left behind.

type Handler

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

Handler is a helper to export methods to handle API/RPC requests.

func (*Handler) AddAddLearnerOperator

func (h *Handler) AddAddLearnerOperator(regionID uint64, toStoreID uint64) error

AddAddLearnerOperator adds an operator to add learner.

func (*Handler) AddAddPeerOperator

func (h *Handler) AddAddPeerOperator(regionID uint64, toStoreID uint64) error

AddAddPeerOperator adds an operator to add peer.

func (*Handler) AddAdjacentRegionScheduler

func (h *Handler) AddAdjacentRegionScheduler(args ...string) error

AddAdjacentRegionScheduler adds a balance-adjacent-region-scheduler.

func (*Handler) AddBalanceHotRegionScheduler

func (h *Handler) AddBalanceHotRegionScheduler() error

AddBalanceHotRegionScheduler adds a balance-hot-region-scheduler.

func (*Handler) AddBalanceLeaderScheduler

func (h *Handler) AddBalanceLeaderScheduler() error

AddBalanceLeaderScheduler adds a balance-leader-scheduler.

func (*Handler) AddBalanceRegionScheduler

func (h *Handler) AddBalanceRegionScheduler() error

AddBalanceRegionScheduler adds a balance-region-scheduler.

func (*Handler) AddEvictLeaderScheduler

func (h *Handler) AddEvictLeaderScheduler(storeID uint64) error

AddEvictLeaderScheduler adds an evict-leader-scheduler.

func (*Handler) AddGrantLeaderScheduler

func (h *Handler) AddGrantLeaderScheduler(storeID uint64) error

AddGrantLeaderScheduler adds a grant-leader-scheduler.

func (*Handler) AddLabelScheduler

func (h *Handler) AddLabelScheduler() error

AddLabelScheduler adds a label-scheduler.

func (*Handler) AddMergeRegionOperator

func (h *Handler) AddMergeRegionOperator(regionID uint64, targetID uint64) error

AddMergeRegionOperator adds an operator to merge region.

func (*Handler) AddRandomMergeScheduler

func (h *Handler) AddRandomMergeScheduler() error

AddRandomMergeScheduler adds a random-merge-scheduler.

func (*Handler) AddRemovePeerOperator

func (h *Handler) AddRemovePeerOperator(regionID uint64, fromStoreID uint64) error

AddRemovePeerOperator adds an operator to remove peer.

func (*Handler) AddScatterRangeScheduler

func (h *Handler) AddScatterRangeScheduler(args ...string) error

AddScatterRangeScheduler adds a balance-range-leader-scheduler

func (*Handler) AddScatterRegionOperator

func (h *Handler) AddScatterRegionOperator(regionID uint64) error

AddScatterRegionOperator adds an operator to scatter a region.

func (*Handler) AddScheduler

func (h *Handler) AddScheduler(name string, args ...string) error

AddScheduler adds a scheduler.

func (*Handler) AddShuffleHotRegionScheduler

func (h *Handler) AddShuffleHotRegionScheduler(limit uint64) error

AddShuffleHotRegionScheduler adds a shuffle-hot-region-scheduler.

func (*Handler) AddShuffleLeaderScheduler

func (h *Handler) AddShuffleLeaderScheduler() error

AddShuffleLeaderScheduler adds a shuffle-leader-scheduler.

func (*Handler) AddShuffleRegionScheduler

func (h *Handler) AddShuffleRegionScheduler() error

AddShuffleRegionScheduler adds a shuffle-region-scheduler.

func (*Handler) AddSplitRegionOperator

func (h *Handler) AddSplitRegionOperator(regionID uint64, policyStr string, keys []string) error

AddSplitRegionOperator adds an operator to split a region.

func (*Handler) AddTransferLeaderOperator

func (h *Handler) AddTransferLeaderOperator(regionID uint64, storeID uint64) error

AddTransferLeaderOperator adds an operator to transfer leader to the store.

func (*Handler) AddTransferPeerOperator

func (h *Handler) AddTransferPeerOperator(regionID uint64, fromStoreID, toStoreID uint64) error

AddTransferPeerOperator adds an operator to transfer peer.

func (*Handler) AddTransferRegionOperator

func (h *Handler) AddTransferRegionOperator(regionID uint64, storeIDs map[uint64]struct{}) error

AddTransferRegionOperator adds an operator to transfer region to the stores.

func (*Handler) GetAddr

func (h *Handler) GetAddr() string

GetAddr returns the server urls for clients.

func (*Handler) GetAdminOperators

func (h *Handler) GetAdminOperators() ([]*operator.Operator, error)

GetAdminOperators returns the running admin operators.

func (*Handler) GetAllStoresLimit

func (h *Handler) GetAllStoresLimit(limitType storelimit.Type) (map[uint64]config.StoreLimitConfig, error)

GetAllStoresLimit is used to get limit of all stores.

func (*Handler) GetDownPeerRegions

func (h *Handler) GetDownPeerRegions() ([]*core.RegionInfo, error)

GetDownPeerRegions gets the region with down peer.

func (*Handler) GetEmptyRegion

func (h *Handler) GetEmptyRegion() ([]*core.RegionInfo, error)

GetEmptyRegion gets the region with empty size.

func (*Handler) GetExtraPeerRegions

func (h *Handler) GetExtraPeerRegions() ([]*core.RegionInfo, error)

GetExtraPeerRegions gets the region exceeds the specified number of peers.

func (*Handler) GetHistory

func (h *Handler) GetHistory(start time.Time) ([]operator.OpHistory, error)

GetHistory returns finished operators' history since start.

func (*Handler) GetHotBytesReadStores

func (h *Handler) GetHotBytesReadStores() map[uint64]float64

GetHotBytesReadStores gets all hot write stores stats.

func (*Handler) GetHotBytesWriteStores

func (h *Handler) GetHotBytesWriteStores() map[uint64]float64

GetHotBytesWriteStores gets all hot write stores stats.

func (*Handler) GetHotKeysReadStores

func (h *Handler) GetHotKeysReadStores() map[uint64]float64

GetHotKeysReadStores gets all hot write stores stats.

func (*Handler) GetHotKeysWriteStores

func (h *Handler) GetHotKeysWriteStores() map[uint64]float64

GetHotKeysWriteStores gets all hot write stores stats.

func (*Handler) GetHotReadRegions

func (h *Handler) GetHotReadRegions() *statistics.StoreHotPeersInfos

GetHotReadRegions gets all hot read regions stats.

func (*Handler) GetHotWriteRegions

func (h *Handler) GetHotWriteRegions() *statistics.StoreHotPeersInfos

GetHotWriteRegions gets all hot write regions stats.

func (*Handler) GetLeaderOperators

func (h *Handler) GetLeaderOperators() ([]*operator.Operator, error)

GetLeaderOperators returns the running leader operators.

func (*Handler) GetMissPeerRegions

func (h *Handler) GetMissPeerRegions() ([]*core.RegionInfo, error)

GetMissPeerRegions gets the region less than the specified number of peers.

func (*Handler) GetOfflinePeer

func (h *Handler) GetOfflinePeer() ([]*core.RegionInfo, error)

GetOfflinePeer gets the region with offline peer.

func (*Handler) GetOperator

func (h *Handler) GetOperator(regionID uint64) (*operator.Operator, error)

GetOperator returns the region operator.

func (*Handler) GetOperatorController

func (h *Handler) GetOperatorController() (*schedule.OperatorController, error)

GetOperatorController returns OperatorController.

func (*Handler) GetOperatorStatus

func (h *Handler) GetOperatorStatus(regionID uint64) (*schedule.OperatorWithStatus, error)

GetOperatorStatus returns the status of the region operator.

func (*Handler) GetOperators

func (h *Handler) GetOperators() ([]*operator.Operator, error)

GetOperators returns the running operators.

func (*Handler) GetOperatorsOfKind

func (h *Handler) GetOperatorsOfKind(mask operator.OpKind) ([]*operator.Operator, error)

GetOperatorsOfKind returns the running operators of the kind.

func (*Handler) GetPendingPeerRegions

func (h *Handler) GetPendingPeerRegions() ([]*core.RegionInfo, error)

GetPendingPeerRegions gets the region with pending peer.

func (*Handler) GetRaftCluster

func (h *Handler) GetRaftCluster() (*cluster.RaftCluster, error)

GetRaftCluster returns RaftCluster.

func (*Handler) GetRegionOperators

func (h *Handler) GetRegionOperators() ([]*operator.Operator, error)

GetRegionOperators returns the running region operators.

func (*Handler) GetScheduleConfig

func (h *Handler) GetScheduleConfig() *config.ScheduleConfig

GetScheduleConfig returns ScheduleConfig.

func (*Handler) GetSchedulerConfigHandler

func (h *Handler) GetSchedulerConfigHandler() http.Handler

GetSchedulerConfigHandler gets the handler of schedulers.

func (*Handler) GetSchedulers

func (h *Handler) GetSchedulers() ([]string, error)

GetSchedulers returns all names of schedulers.

func (*Handler) GetStoreLimitScene

func (h *Handler) GetStoreLimitScene(limitType storelimit.Type) *storelimit.Scene

GetStoreLimitScene returns the limit valus for different scenes

func (*Handler) GetStores

func (h *Handler) GetStores() ([]*core.StoreInfo, error)

GetStores returns all stores in the cluster.

func (*Handler) GetWaitingOperators

func (h *Handler) GetWaitingOperators() ([]*operator.Operator, error)

GetWaitingOperators returns the waiting operators.

func (*Handler) IsSchedulerPaused

func (h *Handler) IsSchedulerPaused(name string) (bool, error)

IsSchedulerPaused returns whether scheduler is paused.

func (*Handler) PauseOrResumeScheduler

func (h *Handler) PauseOrResumeScheduler(name string, t int64) error

PauseOrResumeScheduler pasues a scheduler for delay seconds or resume a paused scheduler. t == 0 : resume scheduler. t > 0 : scheduler delays t seconds.

func (*Handler) PluginLoad

func (h *Handler) PluginLoad(pluginPath string) error

PluginLoad loads the plugin referenced by the pluginPath

func (*Handler) PluginUnload

func (h *Handler) PluginUnload(pluginPath string) error

PluginUnload unloads the plugin referenced by the pluginPath

func (*Handler) RemoveOperator

func (h *Handler) RemoveOperator(regionID uint64) error

RemoveOperator removes the region operator.

func (*Handler) RemoveScheduler

func (h *Handler) RemoveScheduler(name string) error

RemoveScheduler removes a scheduler by name.

func (*Handler) ResetTS

func (h *Handler) ResetTS(ts uint64) error

ResetTS resets the ts with specified tso.

func (*Handler) SetAllStoresLimit

func (h *Handler) SetAllStoresLimit(ratePerMin float64, limitType storelimit.Type) error

SetAllStoresLimit is used to set limit of all stores.

func (*Handler) SetStoreLimit

func (h *Handler) SetStoreLimit(storeID uint64, ratePerMin float64, limitType storelimit.Type) error

SetStoreLimit is used to set the limit of a store.

func (*Handler) SetStoreLimitScene

func (h *Handler) SetStoreLimitScene(scene *storelimit.Scene, limitType storelimit.Type)

SetStoreLimitScene sets the limit values for differents scenes

type HandlerBuilder

type HandlerBuilder func(context.Context, *Server) (http.Handler, ServiceGroup, error)

HandlerBuilder builds a server HTTP handler.

type Server

type Server struct {
	diagnosticspb.DiagnosticsServer
	// contains filtered or unexported fields
}

Server is the pd server.

func CreateServer

func CreateServer(ctx context.Context, cfg *config.Config, serviceBuilders ...HandlerBuilder) (*Server, error)

CreateServer creates the UNINITIALIZED pd server with given configuration.

func (*Server) AddCloseCallback

func (s *Server) AddCloseCallback(callbacks ...func())

AddCloseCallback adds a callback in the Close phase.

func (*Server) AddStartCallback

func (s *Server) AddStartCallback(callbacks ...func())

AddStartCallback adds a callback in the startServer phase.

func (*Server) AllocID

func (s *Server) AllocID(ctx context.Context, request *pdpb.AllocIDRequest) (*pdpb.AllocIDResponse, error)

AllocID implements gRPC PDServer.

func (*Server) AskBatchSplit

func (s *Server) AskBatchSplit(ctx context.Context, request *pdpb.AskBatchSplitRequest) (*pdpb.AskBatchSplitResponse, error)

AskBatchSplit implements gRPC PDServer.

func (*Server) AskSplit

func (s *Server) AskSplit(ctx context.Context, request *pdpb.AskSplitRequest) (*pdpb.AskSplitResponse, error)

AskSplit implements gRPC PDServer.

func (*Server) Bootstrap

func (s *Server) Bootstrap(ctx context.Context, request *pdpb.BootstrapRequest) (*pdpb.BootstrapResponse, error)

Bootstrap implements gRPC PDServer.

func (*Server) Close

func (s *Server) Close()

Close closes the server.

func (*Server) ClusterID

func (s *Server) ClusterID() uint64

ClusterID returns the cluster ID of this server.

func (*Server) Context

func (s *Server) Context() context.Context

Context returns the context of server.

func (*Server) DeleteLabelProperty

func (s *Server) DeleteLabelProperty(typ, labelKey, labelValue string) error

DeleteLabelProperty deletes a label property config.

func (*Server) GetAddr

func (s *Server) GetAddr() string

GetAddr returns the server urls for clients.

func (*Server) GetAllStores

func (s *Server) GetAllStores(ctx context.Context, request *pdpb.GetAllStoresRequest) (*pdpb.GetAllStoresResponse, error)

GetAllStores implements gRPC PDServer.

func (*Server) GetAllocator

func (s *Server) GetAllocator() *id.AllocatorImpl

GetAllocator returns the ID allocator of server.

func (*Server) GetBasicCluster

func (s *Server) GetBasicCluster() *core.BasicCluster

GetBasicCluster returns the basic cluster of server.

func (*Server) GetClient

func (s *Server) GetClient() *clientv3.Client

GetClient returns builtin etcd client.

func (*Server) GetClientScheme added in v4.0.2

func (s *Server) GetClientScheme() string

GetClientScheme returns the client URL scheme

func (*Server) GetCluster

func (s *Server) GetCluster() *metapb.Cluster

GetCluster gets cluster.

func (*Server) GetClusterConfig

func (s *Server) GetClusterConfig(ctx context.Context, request *pdpb.GetClusterConfigRequest) (*pdpb.GetClusterConfigResponse, error)

GetClusterConfig implements gRPC PDServer.

func (*Server) GetClusterRootPath

func (s *Server) GetClusterRootPath() string

GetClusterRootPath returns the cluster root path.

func (*Server) GetClusterStatus

func (s *Server) GetClusterStatus() (*cluster.Status, error)

GetClusterStatus gets cluster status.

func (*Server) GetClusterVersion

func (s *Server) GetClusterVersion() semver.Version

GetClusterVersion returns the version of cluster.

func (*Server) GetConfig

func (s *Server) GetConfig() *config.Config

GetConfig gets the config information.

func (*Server) GetEndpoints

func (s *Server) GetEndpoints() []string

GetEndpoints returns the etcd endpoints for outer use.

func (*Server) GetGCSafePoint

func (s *Server) GetGCSafePoint(ctx context.Context, request *pdpb.GetGCSafePointRequest) (*pdpb.GetGCSafePointResponse, error)

GetGCSafePoint implements gRPC PDServer.

func (*Server) GetHBStreams

func (s *Server) GetHBStreams() opt.HeartbeatStreams

GetHBStreams returns the heartbeat streams.

func (*Server) GetHTTPClient

func (s *Server) GetHTTPClient() *http.Client

GetHTTPClient returns builtin etcd client.

func (*Server) GetHandler

func (s *Server) GetHandler() *Handler

GetHandler returns the handler for API.

func (*Server) GetLabelProperty

func (s *Server) GetLabelProperty() config.LabelPropertyConfig

GetLabelProperty returns the whole label property config.

func (*Server) GetLeader

func (s *Server) GetLeader() *pdpb.Member

GetLeader returns leader of etcd.

func (*Server) GetMember

func (s *Server) GetMember() *member.Member

GetMember returns the member of server.

func (*Server) GetMemberInfo

func (s *Server) GetMemberInfo() *pdpb.Member

GetMemberInfo returns the server member information.

func (*Server) GetMembers

GetMembers implements gRPC PDServer.

func (*Server) GetMetaRegions

func (s *Server) GetMetaRegions() []*metapb.Region

GetMetaRegions gets meta regions from cluster.

func (*Server) GetOperator

func (s *Server) GetOperator(ctx context.Context, request *pdpb.GetOperatorRequest) (*pdpb.GetOperatorResponse, error)

GetOperator gets information about the operator belonging to the speicfy region.

func (*Server) GetPDServerConfig

func (s *Server) GetPDServerConfig() *config.PDServerConfig

GetPDServerConfig gets the balance config information.

func (*Server) GetPersistOptions

func (s *Server) GetPersistOptions() *config.PersistOptions

GetPersistOptions returns the schedule option.

func (*Server) GetPrevRegion

func (s *Server) GetPrevRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)

GetPrevRegion implements gRPC PDServer

func (*Server) GetRaftCluster

func (s *Server) GetRaftCluster() *cluster.RaftCluster

GetRaftCluster gets Raft cluster. If cluster has not been bootstrapped, return nil.

func (*Server) GetRegion

func (s *Server) GetRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)

GetRegion implements gRPC PDServer.

func (*Server) GetRegionByID

func (s *Server) GetRegionByID(ctx context.Context, request *pdpb.GetRegionByIDRequest) (*pdpb.GetRegionResponse, error)

GetRegionByID implements gRPC PDServer.

func (*Server) GetRegions

func (s *Server) GetRegions() []*core.RegionInfo

GetRegions gets regions from cluster.

func (*Server) GetReplicationConfig

func (s *Server) GetReplicationConfig() *config.ReplicationConfig

GetReplicationConfig get the replication config.

func (*Server) GetReplicationModeConfig

func (s *Server) GetReplicationModeConfig() *config.ReplicationModeConfig

GetReplicationModeConfig returns the replication mode config.

func (*Server) GetScheduleConfig

func (s *Server) GetScheduleConfig() *config.ScheduleConfig

GetScheduleConfig gets the balance config information.

func (*Server) GetSecurityConfig

func (s *Server) GetSecurityConfig() *grpcutil.SecurityConfig

GetSecurityConfig get the security config.

func (*Server) GetServerOption

func (s *Server) GetServerOption() *config.PersistOptions

GetServerOption gets the option of the server.

func (*Server) GetStorage

func (s *Server) GetStorage() *core.Storage

GetStorage returns the backend storage of server.

func (*Server) GetStore

func (s *Server) GetStore(ctx context.Context, request *pdpb.GetStoreRequest) (*pdpb.GetStoreResponse, error)

GetStore implements gRPC PDServer.

func (*Server) IsBootstrapped

func (s *Server) IsBootstrapped(ctx context.Context, request *pdpb.IsBootstrappedRequest) (*pdpb.IsBootstrappedResponse, error)

IsBootstrapped implements gRPC PDServer.

func (*Server) IsClosed

func (s *Server) IsClosed() bool

IsClosed checks whether server is closed or not.

func (*Server) LoopContext

func (s *Server) LoopContext() context.Context

LoopContext returns the loop context of server.

func (*Server) Name

func (s *Server) Name() string

Name returns the unique etcd Name for this server in etcd cluster.

func (*Server) PersistFile

func (s *Server) PersistFile(name string, data []byte) error

PersistFile saves a file in DataDir.

func (*Server) PutClusterConfig

func (s *Server) PutClusterConfig(ctx context.Context, request *pdpb.PutClusterConfigRequest) (*pdpb.PutClusterConfigResponse, error)

PutClusterConfig implements gRPC PDServer.

func (*Server) PutStore

func (s *Server) PutStore(ctx context.Context, request *pdpb.PutStoreRequest) (*pdpb.PutStoreResponse, error)

PutStore implements gRPC PDServer.

func (*Server) RegionHeartbeat

func (s *Server) RegionHeartbeat(stream pdpb.PD_RegionHeartbeatServer) error

RegionHeartbeat implements gRPC PDServer.

func (*Server) ReplicateFileToAllMembers

func (s *Server) ReplicateFileToAllMembers(ctx context.Context, name string, data []byte) error

ReplicateFileToAllMembers is used to synchronize state among all members. Each member will write `data` to a local file named `name`.

func (*Server) ReportBatchSplit

func (s *Server) ReportBatchSplit(ctx context.Context, request *pdpb.ReportBatchSplitRequest) (*pdpb.ReportBatchSplitResponse, error)

ReportBatchSplit implements gRPC PDServer.

func (*Server) ReportSplit

func (s *Server) ReportSplit(ctx context.Context, request *pdpb.ReportSplitRequest) (*pdpb.ReportSplitResponse, error)

ReportSplit implements gRPC PDServer.

func (*Server) Run

func (s *Server) Run() error

Run runs the pd server.

func (*Server) ScanRegions

func (s *Server) ScanRegions(ctx context.Context, request *pdpb.ScanRegionsRequest) (*pdpb.ScanRegionsResponse, error)

ScanRegions implements gRPC PDServer.

func (*Server) ScatterRegion

func (s *Server) ScatterRegion(ctx context.Context, request *pdpb.ScatterRegionRequest) (*pdpb.ScatterRegionResponse, error)

ScatterRegion implements gRPC PDServer.

func (*Server) SetClusterVersion

func (s *Server) SetClusterVersion(v string) error

SetClusterVersion sets the version of cluster.

func (*Server) SetLabelProperty

func (s *Server) SetLabelProperty(typ, labelKey, labelValue string) error

SetLabelProperty inserts a label property config.

func (*Server) SetLabelPropertyConfig

func (s *Server) SetLabelPropertyConfig(cfg config.LabelPropertyConfig) error

SetLabelPropertyConfig sets the label property config.

func (*Server) SetLogLevel

func (s *Server) SetLogLevel(level string) error

SetLogLevel sets log level.

func (*Server) SetPDServerConfig

func (s *Server) SetPDServerConfig(cfg config.PDServerConfig) error

SetPDServerConfig sets the server config.

func (*Server) SetReplicationConfig

func (s *Server) SetReplicationConfig(cfg config.ReplicationConfig) error

SetReplicationConfig sets the replication config.

func (*Server) SetReplicationModeConfig

func (s *Server) SetReplicationModeConfig(cfg config.ReplicationModeConfig) error

SetReplicationModeConfig sets the replication mode.

func (*Server) SetScheduleConfig

func (s *Server) SetScheduleConfig(cfg config.ScheduleConfig) error

SetScheduleConfig sets the balance config information.

func (*Server) SetStorage

func (s *Server) SetStorage(storage *core.Storage)

SetStorage changes the storage only for test purpose. When we use it, we should prevent calling GetStorage, otherwise, it may cause a data race problem.

func (*Server) StartTimestamp

func (s *Server) StartTimestamp() int64

StartTimestamp returns the start timestamp of this server

func (*Server) StoreHeartbeat

func (s *Server) StoreHeartbeat(ctx context.Context, request *pdpb.StoreHeartbeatRequest) (*pdpb.StoreHeartbeatResponse, error)

StoreHeartbeat implements gRPC PDServer.

func (*Server) SyncRegions

func (s *Server) SyncRegions(stream pdpb.PD_SyncRegionsServer) error

SyncRegions syncs the regions.

func (*Server) Tso

func (s *Server) Tso(stream pdpb.PD_TsoServer) error

Tso implements gRPC PDServer.

func (*Server) UpdateGCSafePoint

func (s *Server) UpdateGCSafePoint(ctx context.Context, request *pdpb.UpdateGCSafePointRequest) (*pdpb.UpdateGCSafePointResponse, error)

UpdateGCSafePoint implements gRPC PDServer.

func (*Server) UpdateServiceGCSafePoint

UpdateServiceGCSafePoint update the safepoint for specific service

type ServiceGroup

type ServiceGroup struct {
	Name       string
	Version    string
	IsCore     bool
	PathPrefix string
}

ServiceGroup used to register the service.

Directories

Path Synopsis
Package core defines core characteristics of the server.
Package core defines core characteristics of the server.
opt

Jump to

Keyboard shortcuts

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