Documentation
¶
Index ¶
- Constants
- Variables
- func CheckAndGetPDVersion() *semver.Version
- func CheckPDVersionWithClusterVersion(opt *config.PersistOptions)
- func NewTestMultiConfig(c *assertutil.Checker, count int) []*config.Config
- func NewTestSingleConfig(c *assertutil.Checker) *config.Config
- type GrpcServer
- func (s *GrpcServer) AllocID(ctx context.Context, request *pdpb.AllocIDRequest) (*pdpb.AllocIDResponse, error)
- func (s *GrpcServer) AskBatchSplit(ctx context.Context, request *pdpb.AskBatchSplitRequest) (*pdpb.AskBatchSplitResponse, error)
- func (s *GrpcServer) AskSplit(ctx context.Context, request *pdpb.AskSplitRequest) (*pdpb.AskSplitResponse, error)
- func (s *GrpcServer) BatchScanRegions(ctx context.Context, request *pdpb.BatchScanRegionsRequest) (*pdpb.BatchScanRegionsResponse, error)
- func (s *GrpcServer) Bootstrap(ctx context.Context, request *pdpb.BootstrapRequest) (*pdpb.BootstrapResponse, error)
- func (s *GrpcServer) GetAllGCSafePointV2(ctx context.Context, request *pdpb.GetAllGCSafePointV2Request) (*pdpb.GetAllGCSafePointV2Response, error)
- func (s *GrpcServer) GetAllStores(ctx context.Context, request *pdpb.GetAllStoresRequest) (*pdpb.GetAllStoresResponse, error)
- func (s *GrpcServer) GetClusterConfig(ctx context.Context, request *pdpb.GetClusterConfigRequest) (*pdpb.GetClusterConfigResponse, error)
- func (s *GrpcServer) GetClusterInfo(context.Context, *pdpb.GetClusterInfoRequest) (*pdpb.GetClusterInfoResponse, error)
- func (s *GrpcServer) GetDCLocationInfo(ctx context.Context, request *pdpb.GetDCLocationInfoRequest) (*pdpb.GetDCLocationInfoResponse, error)
- func (s *GrpcServer) GetExternalTimestamp(ctx context.Context, request *pdpb.GetExternalTimestampRequest) (*pdpb.GetExternalTimestampResponse, error)
- func (s *GrpcServer) GetGCSafePoint(ctx context.Context, request *pdpb.GetGCSafePointRequest) (*pdpb.GetGCSafePointResponse, error)
- func (s *GrpcServer) GetGCSafePointV2(ctx context.Context, request *pdpb.GetGCSafePointV2Request) (*pdpb.GetGCSafePointV2Response, error)
- func (s *GrpcServer) GetMembers(context.Context, *pdpb.GetMembersRequest) (*pdpb.GetMembersResponse, error)
- func (s *GrpcServer) GetMinTS(ctx context.Context, request *pdpb.GetMinTSRequest) (*pdpb.GetMinTSResponse, error)
- func (s *GrpcServer) GetMinTSFromTSOService(dcLocation string) (*pdpb.Timestamp, error)
- func (s *GrpcServer) GetOperator(ctx context.Context, request *pdpb.GetOperatorRequest) (*pdpb.GetOperatorResponse, error)
- func (s *GrpcServer) GetPrevRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)
- func (s *GrpcServer) GetRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)
- func (s *GrpcServer) GetRegionByID(ctx context.Context, request *pdpb.GetRegionByIDRequest) (*pdpb.GetRegionResponse, error)
- func (s *GrpcServer) GetStore(ctx context.Context, request *pdpb.GetStoreRequest) (*pdpb.GetStoreResponse, error)
- func (s *GrpcServer) IsBootstrapped(ctx context.Context, request *pdpb.IsBootstrappedRequest) (*pdpb.IsBootstrappedResponse, error)
- func (s *GrpcServer) IsSnapshotRecovering(ctx context.Context, _ *pdpb.IsSnapshotRecoveringRequest) (*pdpb.IsSnapshotRecoveringResponse, error)
- func (s *GrpcServer) LoadGlobalConfig(ctx context.Context, request *pdpb.LoadGlobalConfigRequest) (*pdpb.LoadGlobalConfigResponse, error)
- func (s *GrpcServer) PutClusterConfig(ctx context.Context, request *pdpb.PutClusterConfigRequest) (*pdpb.PutClusterConfigResponse, error)
- func (s *GrpcServer) PutStore(ctx context.Context, request *pdpb.PutStoreRequest) (*pdpb.PutStoreResponse, error)
- func (s *GrpcServer) RegionHeartbeat(stream pdpb.PD_RegionHeartbeatServer) error
- func (s *GrpcServer) ReportBatchSplit(ctx context.Context, request *pdpb.ReportBatchSplitRequest) (*pdpb.ReportBatchSplitResponse, error)
- func (s *GrpcServer) ReportBuckets(stream pdpb.PD_ReportBucketsServer) error
- func (s *GrpcServer) ReportMinResolvedTS(ctx context.Context, request *pdpb.ReportMinResolvedTsRequest) (*pdpb.ReportMinResolvedTsResponse, error)
- func (s *GrpcServer) ReportSplit(ctx context.Context, request *pdpb.ReportSplitRequest) (*pdpb.ReportSplitResponse, error)
- func (s *GrpcServer) ScanRegions(ctx context.Context, request *pdpb.ScanRegionsRequest) (*pdpb.ScanRegionsResponse, error)deprecated
- func (s *GrpcServer) ScatterRegion(ctx context.Context, request *pdpb.ScatterRegionRequest) (*pdpb.ScatterRegionResponse, error)
- func (s *GrpcServer) SetExternalTimestamp(ctx context.Context, request *pdpb.SetExternalTimestampRequest) (*pdpb.SetExternalTimestampResponse, error)
- func (s *GrpcServer) SplitAndScatterRegions(ctx context.Context, request *pdpb.SplitAndScatterRegionsRequest) (*pdpb.SplitAndScatterRegionsResponse, error)
- func (s *GrpcServer) SplitRegions(ctx context.Context, request *pdpb.SplitRegionsRequest) (*pdpb.SplitRegionsResponse, error)
- func (s *GrpcServer) StoreGlobalConfig(_ context.Context, request *pdpb.StoreGlobalConfigRequest) (*pdpb.StoreGlobalConfigResponse, error)
- func (s *GrpcServer) StoreHeartbeat(ctx context.Context, request *pdpb.StoreHeartbeatRequest) (*pdpb.StoreHeartbeatResponse, error)
- func (s *GrpcServer) SyncMaxTS(_ context.Context, request *pdpb.SyncMaxTSRequest) (*pdpb.SyncMaxTSResponse, error)
- func (s *GrpcServer) SyncRegions(stream pdpb.PD_SyncRegionsServer) error
- func (s *GrpcServer) Tso(stream pdpb.PD_TsoServer) error
- func (s *GrpcServer) UpdateGCSafePoint(ctx context.Context, request *pdpb.UpdateGCSafePointRequest) (*pdpb.UpdateGCSafePointResponse, error)
- func (s *GrpcServer) UpdateGCSafePointV2(ctx context.Context, request *pdpb.UpdateGCSafePointV2Request) (*pdpb.UpdateGCSafePointV2Response, error)
- func (s *GrpcServer) UpdateServiceGCSafePoint(ctx context.Context, request *pdpb.UpdateServiceGCSafePointRequest) (*pdpb.UpdateServiceGCSafePointResponse, error)
- func (s *GrpcServer) UpdateServiceSafePointV2(ctx context.Context, request *pdpb.UpdateServiceSafePointV2Request) (*pdpb.UpdateServiceSafePointV2Response, error)
- func (s *GrpcServer) WatchGCSafePointV2(request *pdpb.WatchGCSafePointV2Request, ...) error
- func (s *GrpcServer) WatchGlobalConfig(req *pdpb.WatchGlobalConfigRequest, server pdpb.PD_WatchGlobalConfigServer) error
- type Handler
- func (h *Handler) AddScheduler(tp types.CheckerSchedulerType, args ...string) error
- func (h *Handler) GetAddr() string
- func (h *Handler) GetAllRequestHistoryHotRegion(request *HistoryHotRegionsRequest) (*storage.HistoryHotRegions, error)
- func (h *Handler) GetHistoryHotRegionIter(hotRegionTypes []string, startTime, endTime int64) storage.HotRegionStorageIterator
- func (h *Handler) GetHistoryHotRegions(typ utils.RWType) ([]storage.HistoryHotRegion, error)
- func (h *Handler) GetHotRegionsReservedDays() uint64
- func (h *Handler) GetHotRegionsWriteInterval() time.Duration
- func (h *Handler) GetProgressByAction(action string) (p, ls, cs float64, err error)
- func (h *Handler) GetProgressByID(storeID string) (action string, p, ls, cs float64, err error)
- func (h *Handler) GetRaftCluster() (*cluster.RaftCluster, error)
- func (h *Handler) GetRegionsByType(typ statistics.RegionStatisticType) ([]*core.RegionInfo, error)
- func (h *Handler) GetScheduleConfig() *sc.ScheduleConfig
- func (h *Handler) GetSchedulerConfigHandler() (http.Handler, error)
- func (h *Handler) GetStoreLimitScene(limitType storelimit.Type) *storelimit.Scene
- func (h *Handler) IsLeader() bool
- func (h *Handler) IsSchedulerExisted(name string) (bool, error)
- func (h *Handler) PluginLoad(pluginPath string) error
- func (h *Handler) PluginUnload(pluginPath string) error
- func (h *Handler) RedirectSchedulerUpdate(name string, storeID float64) error
- func (h *Handler) RemoveScheduler(name string) error
- func (h *Handler) ResetTS(ts uint64, ignoreSmaller, skipUpperBoundCheck bool, _ uint32) error
- func (h *Handler) SetAllStoresLimit(ratePerMin float64, limitType storelimit.Type) error
- func (h *Handler) SetAllStoresLimitTTL(ratePerMin float64, limitType storelimit.Type, ttl time.Duration) error
- func (h *Handler) SetLabelStoresLimit(ratePerMin float64, limitType storelimit.Type, labels []*metapb.StoreLabel) error
- func (h *Handler) SetStoreLimit(storeID uint64, ratePerMin float64, limitType storelimit.Type) error
- func (h *Handler) SetStoreLimitScene(scene *storelimit.Scene, limitType storelimit.Type)
- func (h *Handler) SetStoreLimitTTL(data string, value float64, ttl time.Duration) error
- type HandlerBuilder
- type HistoryHotRegionsRequest
- type KeyspaceServer
- func (s *KeyspaceServer) GetAllKeyspaces(_ context.Context, request *keyspacepb.GetAllKeyspacesRequest) (*keyspacepb.GetAllKeyspacesResponse, error)
- func (s *KeyspaceServer) LoadKeyspace(_ context.Context, request *keyspacepb.LoadKeyspaceRequest) (*keyspacepb.LoadKeyspaceResponse, error)
- func (s *KeyspaceServer) UpdateKeyspaceState(_ context.Context, request *keyspacepb.UpdateKeyspaceStateRequest) (*keyspacepb.UpdateKeyspaceStateResponse, error)
- func (s *KeyspaceServer) WatchKeyspaces(request *keyspacepb.WatchKeyspacesRequest, ...) error
- type Server
- func (s *Server) AddCloseCallback(callbacks ...func())
- func (s *Server) AddServiceLabel(serviceLabel string, accessPath apiutil.AccessPath)
- func (s *Server) AddServiceReadyCallback(callbacks ...func(context.Context) error)
- func (s *Server) AddStartCallback(callbacks ...func())
- func (s *Server) Close()
- func (s *Server) Context() context.Context
- func (s *Server) DeleteLabelProperty(typ, labelKey, labelValue string) error
- func (s *Server) DirectlyGetRaftCluster() *cluster.RaftCluster
- func (s *Server) GetAPIAccessServiceLabel(accessPath apiutil.AccessPath) string
- func (s *Server) GetAddr() string
- func (s *Server) GetAllocator() id.Allocator
- func (s *Server) GetAuditBackend() []audit.Backend
- func (s *Server) GetAuditConfig() *config.AuditConfig
- func (s *Server) GetBasicCluster() *core.BasicCluster
- func (s *Server) GetClient() *clientv3.Client
- func (s *Server) GetClientScheme() string
- func (s *Server) GetCluster() *metapb.Cluster
- func (s *Server) GetClusterStatus() (*cluster.Status, error)
- func (s *Server) GetClusterVersion() semver.Version
- func (s *Server) GetConfig() *config.Config
- func (s *Server) GetControllerConfig() *rm_server.ControllerConfig
- func (s *Server) GetEndpoints() []string
- func (s *Server) GetExternalTS() uint64
- func (s *Server) GetGRPCRateLimitConfig() *config.GRPCRateLimitConfig
- func (s *Server) GetGRPCRateLimiter() *ratelimit.Controller
- func (s *Server) GetGlobalTSOAllocator() tso.Allocator
- func (s *Server) GetHBStreams() *hbstream.HeartbeatStreams
- func (s *Server) GetHTTPClient() *http.Client
- func (s *Server) GetHandler() *Handler
- func (s *Server) GetHistoryHotRegionStorage() *storage.HotRegionStorage
- func (s *Server) GetKeyspaceConfig() *config.KeyspaceConfig
- func (s *Server) GetKeyspaceGroupManager() *keyspace.GroupManager
- func (s *Server) GetKeyspaceManager() *keyspace.Manager
- func (s *Server) GetLabelProperty() config.LabelPropertyConfig
- func (s *Server) GetLeader() *pdpb.Member
- func (s *Server) GetLeaderLease() int64
- func (s *Server) GetLeaderListenUrls() []string
- func (s *Server) GetMaxConcurrentTSOProxyStreamings() int
- func (s *Server) GetMaxResetTSGap() time.Duration
- func (s *Server) GetMember() *member.EmbeddedEtcdMember
- func (s *Server) GetMemberInfo() *pdpb.Member
- func (s *Server) GetMembers() ([]*pdpb.Member, error)
- func (s *Server) GetMetaRegions() []*metapb.Region
- func (s *Server) GetMicroServiceConfig() *config.MicroServiceConfig
- func (s *Server) GetPDServerConfig() *config.PDServerConfig
- func (s *Server) GetPersistOptions() *config.PersistOptions
- func (s *Server) GetRaftCluster() *cluster.RaftCluster
- func (s *Server) GetRateLimitConfig() *config.RateLimitConfig
- func (s *Server) GetRegions() []*core.RegionInfo
- func (s *Server) GetReplicationConfig() *sc.ReplicationConfig
- func (s *Server) GetReplicationModeConfig() *config.ReplicationModeConfig
- func (s *Server) GetSafePointV2Manager() *gc.SafePointV2Manager
- func (s *Server) GetScheduleConfig() *sc.ScheduleConfig
- func (s *Server) GetServerOption() *config.PersistOptions
- func (s *Server) GetServiceAuditBackendLabels(serviceLabel string) *audit.BackendLabels
- func (s *Server) GetServiceLabels(serviceLabel string) []apiutil.AccessPath
- func (s *Server) GetServiceMiddlewareConfig() *config.ServiceMiddlewareConfig
- func (s *Server) GetServiceMiddlewarePersistOptions() *config.ServiceMiddlewarePersistOptions
- func (s *Server) GetServicePrimaryAddr(ctx context.Context, serviceName string) (string, bool)
- func (s *Server) GetServiceRateLimiter() *ratelimit.Controller
- func (s *Server) GetStorage() storage.Storage
- func (s *Server) GetTLSConfig() *grpcutil.TLSConfig
- func (s *Server) GetTSOAllocatorManager() *tso.AllocatorManager
- func (s *Server) GetTSOProxyRecvFromClientTimeout() time.Duration
- func (s *Server) GetTSOSaveInterval() time.Duration
- func (s *Server) GetTSOUpdatePhysicalInterval() time.Duration
- func (s *Server) IsAPIServiceMode() bool
- func (s *Server) IsClosed() bool
- func (s *Server) IsGRPCServiceLabelExist(serviceLabel string) bool
- func (s *Server) IsInRateLimitAllowList(serviceLabel string) bool
- func (s *Server) IsLocalTSOEnabled() bool
- func (s *Server) IsServiceIndependent(name string) bool
- func (s *Server) IsServing() bool
- func (s *Server) IsSnapshotRecovering(ctx context.Context) (bool, error)
- func (s *Server) IsTTLConfigExist(key string) bool
- func (s *Server) LoopContext() context.Context
- func (s *Server) MarkSnapshotRecovering() error
- func (s *Server) Name() string
- func (s *Server) PersistFile(name string, data []byte) error
- func (s *Server) RecoverAllocID(_ context.Context, id uint64) error
- func (s *Server) ReplicateFileToMember(ctx context.Context, member *pdpb.Member, name string, data []byte) error
- func (s *Server) Run() error
- func (s *Server) SaveTTLConfig(data map[string]any, ttl time.Duration) error
- func (s *Server) SetAuditConfig(cfg config.AuditConfig) error
- func (s *Server) SetClient(client *clientv3.Client)
- func (s *Server) SetClusterVersion(v string) error
- func (s *Server) SetEnableLocalTSO(enableLocalTSO bool)
- func (s *Server) SetExternalTS(externalTS, globalTS uint64) error
- func (s *Server) SetGRPCRateLimitConfig(cfg config.GRPCRateLimitConfig) error
- func (s *Server) SetKeyspaceConfig(cfg config.KeyspaceConfig) error
- func (s *Server) SetKeyspaceManager(keyspaceManager *keyspace.Manager)
- func (s *Server) SetLabelProperty(typ, labelKey, labelValue string) error
- func (s *Server) SetLabelPropertyConfig(cfg config.LabelPropertyConfig) error
- func (s *Server) SetLogLevel(level string) error
- func (s *Server) SetMicroServiceConfig(cfg config.MicroServiceConfig) error
- func (s *Server) SetPDServerConfig(cfg config.PDServerConfig) error
- func (s *Server) SetRateLimitConfig(cfg config.RateLimitConfig) error
- func (s *Server) SetReplicationConfig(cfg sc.ReplicationConfig) error
- func (s *Server) SetReplicationModeConfig(cfg config.ReplicationModeConfig) error
- func (s *Server) SetScheduleConfig(cfg sc.ScheduleConfig) error
- func (s *Server) SetServiceAuditBackendForHTTP(route *mux.Route, labels ...string)
- func (s *Server) SetServiceAuditBackendLabels(serviceLabel string, labels []string)
- func (s *Server) SetServicePrimaryAddr(serviceName, addr string)
- func (s *Server) SetStorage(storage storage.Storage)
- func (s *Server) StartTimestamp() int64
- func (s *Server) UnmarkSnapshotRecovering(ctx context.Context) error
- func (s *Server) UpdateGRPCRateLimit(cfg *config.GRPCRateLimitConfig, key string, value any) error
- func (s *Server) UpdateGRPCRateLimitConfig(key, label string, value ratelimit.DimensionConfig) error
- func (s *Server) UpdateGRPCServiceRateLimiter(serviceLabel string, opts ...ratelimit.Option) ratelimit.UpdateStatus
- func (s *Server) UpdateRateLimit(cfg *config.RateLimitConfig, key string, value any) error
- func (s *Server) UpdateRateLimitConfig(key, label string, value ratelimit.DimensionConfig) error
- func (s *Server) UpdateServiceRateLimiter(serviceLabel string, opts ...ratelimit.Option) ratelimit.UpdateStatus
Constants ¶
const ( // PDMode represents that server is in PD mode. PDMode = "PD" // APIServiceMode represents that server is in API service mode. APIServiceMode = "API Service" )
Variables ¶
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") ErrSendHeartbeatTimeout = status.Errorf(codes.DeadlineExceeded, "send heartbeat timeout") ErrNotFoundTSOAddr = status.Errorf(codes.NotFound, "not found tso address") ErrNotFoundSchedulingAddr = status.Errorf(codes.NotFound, "not found scheduling address") ErrNotFoundService = status.Errorf(codes.NotFound, "not found service") ErrForwardTSOTimeout = status.Errorf(codes.DeadlineExceeded, "forward tso request timeout") ErrMaxCountTSOProxyRoutinesExceeded = status.Errorf(codes.ResourceExhausted, "max count of concurrent tso proxy routines exceeded") ErrTSOProxyRecvFromClientTimeout = status.Errorf(codes.DeadlineExceeded, "tso proxy timeout when receiving from client; stream closed by server") ErrEtcdNotStarted = status.Errorf(codes.Unavailable, "server is started, but etcd not started") ErrFollowerHandlingNotAllowed = status.Errorf(codes.Unavailable, "not leader and follower handling not allowed") )
gRPC errors
var EtcdStartTimeout = time.Minute * 5
EtcdStartTimeout the timeout of the startup etcd.
var SchedulerConfigHandlerPath = "/api/v1/scheduler-config"
SchedulerConfigHandlerPath is the api router path of the schedule config handler.
Functions ¶
func CheckAndGetPDVersion ¶
CheckAndGetPDVersion checks and returns the PD version.
func CheckPDVersionWithClusterVersion ¶
func CheckPDVersionWithClusterVersion(opt *config.PersistOptions)
CheckPDVersionWithClusterVersion checks if PD needs to be upgraded by comparing the PD version with the cluster version.
func NewTestMultiConfig ¶
func NewTestMultiConfig(c *assertutil.Checker, count int) []*config.Config
NewTestMultiConfig is only for test to create multiple pd configurations. Because PD client also needs this, so export here.
func NewTestSingleConfig ¶
func NewTestSingleConfig(c *assertutil.Checker) *config.Config
NewTestSingleConfig is only for test to create one pd. Because PD client also needs this, so export here.
Types ¶
type GrpcServer ¶
type GrpcServer struct {
*Server
// contains filtered or unexported fields
}
GrpcServer wraps Server to provide grpc service.
func (*GrpcServer) AllocID ¶
func (s *GrpcServer) AllocID(ctx context.Context, request *pdpb.AllocIDRequest) (*pdpb.AllocIDResponse, error)
AllocID implements gRPC PDServer.
func (*GrpcServer) AskBatchSplit ¶
func (s *GrpcServer) AskBatchSplit(ctx context.Context, request *pdpb.AskBatchSplitRequest) (*pdpb.AskBatchSplitResponse, error)
AskBatchSplit implements gRPC PDServer.
func (*GrpcServer) AskSplit ¶
func (s *GrpcServer) AskSplit(ctx context.Context, request *pdpb.AskSplitRequest) (*pdpb.AskSplitResponse, error)
AskSplit implements gRPC PDServer.
func (*GrpcServer) BatchScanRegions ¶
func (s *GrpcServer) BatchScanRegions(ctx context.Context, request *pdpb.BatchScanRegionsRequest) (*pdpb.BatchScanRegionsResponse, error)
BatchScanRegions implements gRPC PDServer.
func (*GrpcServer) Bootstrap ¶
func (s *GrpcServer) Bootstrap(ctx context.Context, request *pdpb.BootstrapRequest) (*pdpb.BootstrapResponse, error)
Bootstrap implements gRPC PDServer.
func (*GrpcServer) GetAllGCSafePointV2 ¶
func (s *GrpcServer) GetAllGCSafePointV2(ctx context.Context, request *pdpb.GetAllGCSafePointV2Request) (*pdpb.GetAllGCSafePointV2Response, error)
GetAllGCSafePointV2 return all gc safe point v2.
func (*GrpcServer) GetAllStores ¶
func (s *GrpcServer) GetAllStores(ctx context.Context, request *pdpb.GetAllStoresRequest) (*pdpb.GetAllStoresResponse, error)
GetAllStores implements gRPC PDServer.
func (*GrpcServer) GetClusterConfig ¶
func (s *GrpcServer) GetClusterConfig(ctx context.Context, request *pdpb.GetClusterConfigRequest) (*pdpb.GetClusterConfigResponse, error)
GetClusterConfig implements gRPC PDServer.
func (*GrpcServer) GetClusterInfo ¶
func (s *GrpcServer) GetClusterInfo(context.Context, *pdpb.GetClusterInfoRequest) (*pdpb.GetClusterInfoResponse, error)
GetClusterInfo implements gRPC PDServer.
func (*GrpcServer) GetDCLocationInfo ¶
func (s *GrpcServer) GetDCLocationInfo(ctx context.Context, request *pdpb.GetDCLocationInfoRequest) (*pdpb.GetDCLocationInfoResponse, error)
GetDCLocationInfo gets the dc-location info of the given dc-location from PD leader's TSO allocator manager.
func (*GrpcServer) GetExternalTimestamp ¶
func (s *GrpcServer) GetExternalTimestamp(ctx context.Context, request *pdpb.GetExternalTimestampRequest) (*pdpb.GetExternalTimestampResponse, error)
GetExternalTimestamp implements gRPC PDServer.
func (*GrpcServer) GetGCSafePoint ¶
func (s *GrpcServer) GetGCSafePoint(ctx context.Context, request *pdpb.GetGCSafePointRequest) (*pdpb.GetGCSafePointResponse, error)
GetGCSafePoint implements gRPC PDServer.
func (*GrpcServer) GetGCSafePointV2 ¶
func (s *GrpcServer) GetGCSafePointV2(ctx context.Context, request *pdpb.GetGCSafePointV2Request) (*pdpb.GetGCSafePointV2Response, error)
GetGCSafePointV2 return gc safe point for the given keyspace.
func (*GrpcServer) GetMembers ¶
func (s *GrpcServer) GetMembers(context.Context, *pdpb.GetMembersRequest) (*pdpb.GetMembersResponse, error)
GetMembers implements gRPC PDServer.
func (*GrpcServer) GetMinTS ¶
func (s *GrpcServer) GetMinTS( ctx context.Context, request *pdpb.GetMinTSRequest, ) (*pdpb.GetMinTSResponse, error)
GetMinTS implements gRPC PDServer. In PD service mode, it simply returns a timestamp. In API service mode, it queries all tso servers and gets the minimum timestamp across all keyspace groups.
func (*GrpcServer) GetMinTSFromTSOService ¶
func (s *GrpcServer) GetMinTSFromTSOService(dcLocation string) (*pdpb.Timestamp, error)
GetMinTSFromTSOService queries all tso servers and gets the minimum timestamp across all keyspace groups.
func (*GrpcServer) GetOperator ¶
func (s *GrpcServer) GetOperator(ctx context.Context, request *pdpb.GetOperatorRequest) (*pdpb.GetOperatorResponse, error)
GetOperator gets information about the operator belonging to the specify region.
func (*GrpcServer) GetPrevRegion ¶
func (s *GrpcServer) GetPrevRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)
GetPrevRegion implements gRPC PDServer
func (*GrpcServer) GetRegion ¶
func (s *GrpcServer) GetRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)
GetRegion implements gRPC PDServer.
func (*GrpcServer) GetRegionByID ¶
func (s *GrpcServer) GetRegionByID(ctx context.Context, request *pdpb.GetRegionByIDRequest) (*pdpb.GetRegionResponse, error)
GetRegionByID implements gRPC PDServer.
func (*GrpcServer) GetStore ¶
func (s *GrpcServer) GetStore(ctx context.Context, request *pdpb.GetStoreRequest) (*pdpb.GetStoreResponse, error)
GetStore implements gRPC PDServer.
func (*GrpcServer) IsBootstrapped ¶
func (s *GrpcServer) IsBootstrapped(ctx context.Context, request *pdpb.IsBootstrappedRequest) (*pdpb.IsBootstrappedResponse, error)
IsBootstrapped implements gRPC PDServer.
func (*GrpcServer) IsSnapshotRecovering ¶
func (s *GrpcServer) IsSnapshotRecovering(ctx context.Context, _ *pdpb.IsSnapshotRecoveringRequest) (*pdpb.IsSnapshotRecoveringResponse, error)
IsSnapshotRecovering implements gRPC PDServer.
func (*GrpcServer) LoadGlobalConfig ¶
func (s *GrpcServer) LoadGlobalConfig(ctx context.Context, request *pdpb.LoadGlobalConfigRequest) (*pdpb.LoadGlobalConfigResponse, error)
LoadGlobalConfig support 2 ways to load global config from etcd - `Names` iteratively get value from `ConfigPath/Name` but not care about revision - `ConfigPath` if `Names` is nil can get all values and revision of current path
func (*GrpcServer) PutClusterConfig ¶
func (s *GrpcServer) PutClusterConfig(ctx context.Context, request *pdpb.PutClusterConfigRequest) (*pdpb.PutClusterConfigResponse, error)
PutClusterConfig implements gRPC PDServer.
func (*GrpcServer) PutStore ¶
func (s *GrpcServer) PutStore(ctx context.Context, request *pdpb.PutStoreRequest) (*pdpb.PutStoreResponse, error)
PutStore implements gRPC PDServer.
func (*GrpcServer) RegionHeartbeat ¶
func (s *GrpcServer) RegionHeartbeat(stream pdpb.PD_RegionHeartbeatServer) error
RegionHeartbeat implements gRPC PDServer.
func (*GrpcServer) ReportBatchSplit ¶
func (s *GrpcServer) ReportBatchSplit(ctx context.Context, request *pdpb.ReportBatchSplitRequest) (*pdpb.ReportBatchSplitResponse, error)
ReportBatchSplit implements gRPC PDServer.
func (*GrpcServer) ReportBuckets ¶
func (s *GrpcServer) ReportBuckets(stream pdpb.PD_ReportBucketsServer) error
ReportBuckets implements gRPC PDServer
func (*GrpcServer) ReportMinResolvedTS ¶
func (s *GrpcServer) ReportMinResolvedTS(ctx context.Context, request *pdpb.ReportMinResolvedTsRequest) (*pdpb.ReportMinResolvedTsResponse, error)
ReportMinResolvedTS implements gRPC PDServer.
func (*GrpcServer) ReportSplit ¶
func (s *GrpcServer) ReportSplit(ctx context.Context, request *pdpb.ReportSplitRequest) (*pdpb.ReportSplitResponse, error)
ReportSplit implements gRPC PDServer.
func (*GrpcServer) ScanRegions
deprecated
func (s *GrpcServer) ScanRegions(ctx context.Context, request *pdpb.ScanRegionsRequest) (*pdpb.ScanRegionsResponse, error)
Deprecated: use BatchScanRegions instead. ScanRegions implements gRPC PDServer.
func (*GrpcServer) ScatterRegion ¶
func (s *GrpcServer) ScatterRegion(ctx context.Context, request *pdpb.ScatterRegionRequest) (*pdpb.ScatterRegionResponse, error)
ScatterRegion implements gRPC PDServer.
func (*GrpcServer) SetExternalTimestamp ¶
func (s *GrpcServer) SetExternalTimestamp(ctx context.Context, request *pdpb.SetExternalTimestampRequest) (*pdpb.SetExternalTimestampResponse, error)
SetExternalTimestamp implements gRPC PDServer.
func (*GrpcServer) SplitAndScatterRegions ¶
func (s *GrpcServer) SplitAndScatterRegions(ctx context.Context, request *pdpb.SplitAndScatterRegionsRequest) (*pdpb.SplitAndScatterRegionsResponse, error)
SplitAndScatterRegions split regions by the given split keys, and scatter regions. Only regions which split successfully will be scattered. scatterFinishedPercentage indicates the percentage of successfully split regions that are scattered.
func (*GrpcServer) SplitRegions ¶
func (s *GrpcServer) SplitRegions(ctx context.Context, request *pdpb.SplitRegionsRequest) (*pdpb.SplitRegionsResponse, error)
SplitRegions split regions by the given split keys
func (*GrpcServer) StoreGlobalConfig ¶
func (s *GrpcServer) StoreGlobalConfig(_ context.Context, request *pdpb.StoreGlobalConfigRequest) (*pdpb.StoreGlobalConfigResponse, error)
StoreGlobalConfig store global config into etcd by transaction Since item value needs to support marshal of different struct types, it should be set to `Payload bytes` instead of `Value string`
func (*GrpcServer) StoreHeartbeat ¶
func (s *GrpcServer) StoreHeartbeat(ctx context.Context, request *pdpb.StoreHeartbeatRequest) (*pdpb.StoreHeartbeatResponse, error)
StoreHeartbeat implements gRPC PDServer.
func (*GrpcServer) SyncMaxTS ¶
func (s *GrpcServer) SyncMaxTS(_ context.Context, request *pdpb.SyncMaxTSRequest) (*pdpb.SyncMaxTSResponse, error)
SyncMaxTS will check whether MaxTS is the biggest one among all Local TSOs this PD is holding when skipCheck is set, and write it into all Local TSO Allocators then if it's indeed the biggest one.
func (*GrpcServer) SyncRegions ¶
func (s *GrpcServer) SyncRegions(stream pdpb.PD_SyncRegionsServer) error
SyncRegions syncs the regions.
func (*GrpcServer) Tso ¶
func (s *GrpcServer) Tso(stream pdpb.PD_TsoServer) error
Tso implements gRPC PDServer.
func (*GrpcServer) UpdateGCSafePoint ¶
func (s *GrpcServer) UpdateGCSafePoint(ctx context.Context, request *pdpb.UpdateGCSafePointRequest) (*pdpb.UpdateGCSafePointResponse, error)
UpdateGCSafePoint implements gRPC PDServer.
func (*GrpcServer) UpdateGCSafePointV2 ¶
func (s *GrpcServer) UpdateGCSafePointV2(ctx context.Context, request *pdpb.UpdateGCSafePointV2Request) (*pdpb.UpdateGCSafePointV2Response, error)
UpdateGCSafePointV2 update gc safe point for the given keyspace.
func (*GrpcServer) UpdateServiceGCSafePoint ¶
func (s *GrpcServer) UpdateServiceGCSafePoint(ctx context.Context, request *pdpb.UpdateServiceGCSafePointRequest) (*pdpb.UpdateServiceGCSafePointResponse, error)
UpdateServiceGCSafePoint update the safepoint for specific service
func (*GrpcServer) UpdateServiceSafePointV2 ¶
func (s *GrpcServer) UpdateServiceSafePointV2(ctx context.Context, request *pdpb.UpdateServiceSafePointV2Request) (*pdpb.UpdateServiceSafePointV2Response, error)
UpdateServiceSafePointV2 update service safe point for the given keyspace.
func (*GrpcServer) WatchGCSafePointV2 ¶
func (s *GrpcServer) WatchGCSafePointV2(request *pdpb.WatchGCSafePointV2Request, stream pdpb.PD_WatchGCSafePointV2Server) error
WatchGCSafePointV2 watch keyspaces gc safe point changes.
func (*GrpcServer) WatchGlobalConfig ¶
func (s *GrpcServer) WatchGlobalConfig(req *pdpb.WatchGlobalConfigRequest, server pdpb.PD_WatchGlobalConfigServer) error
WatchGlobalConfig will retry on recoverable errors forever until reconnected by Etcd.Watch() as long as the context has not been canceled or timed out. Watch on revision which greater than or equal to the required revision.
type Handler ¶
Handler is a helper to export methods to handle API/RPC requests.
func (*Handler) AddScheduler ¶
func (h *Handler) AddScheduler(tp types.CheckerSchedulerType, args ...string) error
AddScheduler adds a scheduler.
func (*Handler) GetAllRequestHistoryHotRegion ¶
func (h *Handler) GetAllRequestHistoryHotRegion(request *HistoryHotRegionsRequest) (*storage.HistoryHotRegions, error)
GetAllRequestHistoryHotRegion gets all hot region info in HistoryHotRegion form.
func (*Handler) GetHistoryHotRegionIter ¶
func (h *Handler) GetHistoryHotRegionIter( hotRegionTypes []string, startTime, endTime int64, ) storage.HotRegionStorageIterator
GetHistoryHotRegionIter return a iter which iter all qualified item .
func (*Handler) GetHistoryHotRegions ¶
GetHistoryHotRegions get hot region info in HistoryHotRegion form.
func (*Handler) GetHotRegionsReservedDays ¶
GetHotRegionsReservedDays gets days hot region information is kept.
func (*Handler) GetHotRegionsWriteInterval ¶
GetHotRegionsWriteInterval gets interval for PD to store Hot Region information..
func (*Handler) GetProgressByAction ¶
GetProgressByAction returns the progress details for a given action.
func (*Handler) GetProgressByID ¶
GetProgressByID returns the progress details for a given store ID.
func (*Handler) GetRaftCluster ¶
func (h *Handler) GetRaftCluster() (*cluster.RaftCluster, error)
GetRaftCluster returns RaftCluster.
func (*Handler) GetRegionsByType ¶
func (h *Handler) GetRegionsByType(typ statistics.RegionStatisticType) ([]*core.RegionInfo, error)
GetRegionsByType gets the region with specified type.
func (*Handler) GetScheduleConfig ¶
func (h *Handler) GetScheduleConfig() *sc.ScheduleConfig
GetScheduleConfig returns ScheduleConfig.
func (*Handler) GetSchedulerConfigHandler ¶
GetSchedulerConfigHandler gets the handler of schedulers.
func (*Handler) GetStoreLimitScene ¶
func (h *Handler) GetStoreLimitScene(limitType storelimit.Type) *storelimit.Scene
GetStoreLimitScene returns the limit values for different scenes
func (*Handler) IsSchedulerExisted ¶
IsSchedulerExisted returns whether scheduler is existed.
func (*Handler) PluginLoad ¶
PluginLoad loads the plugin referenced by the pluginPath
func (*Handler) PluginUnload ¶
PluginUnload unloads the plugin referenced by the pluginPath
func (*Handler) RedirectSchedulerUpdate ¶
RedirectSchedulerUpdate update scheduler config. Export this func to help handle damaged store.
func (*Handler) RemoveScheduler ¶
RemoveScheduler removes a scheduler by name.
func (*Handler) SetAllStoresLimit ¶
func (h *Handler) SetAllStoresLimit(ratePerMin float64, limitType storelimit.Type) error
SetAllStoresLimit is used to set limit of all stores.
func (*Handler) SetAllStoresLimitTTL ¶
func (h *Handler) SetAllStoresLimitTTL(ratePerMin float64, limitType storelimit.Type, ttl time.Duration) error
SetAllStoresLimitTTL is used to set limit of all stores with ttl
func (*Handler) SetLabelStoresLimit ¶
func (h *Handler) SetLabelStoresLimit(ratePerMin float64, limitType storelimit.Type, labels []*metapb.StoreLabel) error
SetLabelStoresLimit is used to set limit of label 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 different scenes
type HandlerBuilder ¶
HandlerBuilder builds a server HTTP handler.
func CreateMockHandler ¶
func CreateMockHandler(re *require.Assertions, ip string) HandlerBuilder
CreateMockHandler creates a mock handler for test.
type HistoryHotRegionsRequest ¶
type HistoryHotRegionsRequest struct {
StartTime int64 `json:"start_time,omitempty"`
EndTime int64 `json:"end_time,omitempty"`
RegionIDs []uint64 `json:"region_ids,omitempty"`
StoreIDs []uint64 `json:"store_ids,omitempty"`
PeerIDs []uint64 `json:"peer_ids,omitempty"`
IsLearners []bool `json:"is_learners,omitempty"`
IsLeaders []bool `json:"is_leaders,omitempty"`
HotRegionTypes []string `json:"hot_region_type,omitempty"`
}
HistoryHotRegionsRequest wrap request condition from tidb. it is request from tidb
type KeyspaceServer ¶
type KeyspaceServer struct {
*GrpcServer
}
KeyspaceServer wraps GrpcServer to provide keyspace service.
func (*KeyspaceServer) GetAllKeyspaces ¶
func (s *KeyspaceServer) GetAllKeyspaces(_ context.Context, request *keyspacepb.GetAllKeyspacesRequest) (*keyspacepb.GetAllKeyspacesResponse, error)
GetAllKeyspaces get all keyspace's metadata.
func (*KeyspaceServer) LoadKeyspace ¶
func (s *KeyspaceServer) LoadKeyspace(_ context.Context, request *keyspacepb.LoadKeyspaceRequest) (*keyspacepb.LoadKeyspaceResponse, error)
LoadKeyspace load and return target keyspace metadata. Request must specify keyspace name. On Error, keyspaceMeta in response will be nil, error information will be encoded in response header with corresponding error type.
func (*KeyspaceServer) UpdateKeyspaceState ¶
func (s *KeyspaceServer) UpdateKeyspaceState(_ context.Context, request *keyspacepb.UpdateKeyspaceStateRequest) (*keyspacepb.UpdateKeyspaceStateResponse, error)
UpdateKeyspaceState updates the state of keyspace specified in the request.
func (*KeyspaceServer) WatchKeyspaces ¶
func (s *KeyspaceServer) WatchKeyspaces(request *keyspacepb.WatchKeyspacesRequest, stream keyspacepb.Keyspace_WatchKeyspacesServer) error
WatchKeyspaces captures and sends keyspace metadata changes to the client via gRPC stream. Note: It sends all existing keyspaces as it's first package to the client.
type Server ¶
type Server struct {
diagnosticspb.DiagnosticsServer
// contains filtered or unexported fields
}
Server is the pd server. It implements bs.Server
func CreateServer ¶
func CreateServer(ctx context.Context, cfg *config.Config, services []string, legacyServiceBuilders ...HandlerBuilder) (*Server, error)
CreateServer creates the UNINITIALIZED pd server with given configuration.
func MustWaitLeader ¶
func MustWaitLeader(re *require.Assertions, svrs []*Server) *Server
MustWaitLeader return the leader until timeout.
func NewTestServer ¶
func NewTestServer(re *require.Assertions, c *assertutil.Checker) (*Server, testutil.CleanupFunc, error)
NewTestServer creates a pd server for testing.
func (*Server) AddCloseCallback ¶
func (s *Server) AddCloseCallback(callbacks ...func())
AddCloseCallback adds a callback in the Close phase.
func (*Server) AddServiceLabel ¶
func (s *Server) AddServiceLabel(serviceLabel string, accessPath apiutil.AccessPath)
AddServiceLabel is used to add the relationship between service label and api access path TODO: this function will be used for updating api rate limit config
func (*Server) AddServiceReadyCallback ¶
AddServiceReadyCallback adds callbacks when the server becomes the leader if there is embedded etcd, or the primary otherwise.
func (*Server) AddStartCallback ¶
func (s *Server) AddStartCallback(callbacks ...func())
AddStartCallback adds a callback in the startServer phase.
func (*Server) DeleteLabelProperty ¶
DeleteLabelProperty deletes a label property config.
func (*Server) DirectlyGetRaftCluster ¶
func (s *Server) DirectlyGetRaftCluster() *cluster.RaftCluster
DirectlyGetRaftCluster returns raft cluster directly. Only used for test.
func (*Server) GetAPIAccessServiceLabel ¶
func (s *Server) GetAPIAccessServiceLabel(accessPath apiutil.AccessPath) string
GetAPIAccessServiceLabel returns service label by given access path TODO: this function will be used for updating api rate limit config
func (*Server) GetAllocator ¶
GetAllocator returns the ID allocator of server.
func (*Server) GetAuditBackend ¶
GetAuditBackend returns audit backends
func (*Server) GetAuditConfig ¶
func (s *Server) GetAuditConfig() *config.AuditConfig
GetAuditConfig gets the audit config information.
func (*Server) GetBasicCluster ¶
func (s *Server) GetBasicCluster() *core.BasicCluster
GetBasicCluster returns the basic cluster of server.
func (*Server) GetClientScheme ¶
GetClientScheme returns the client URL scheme
func (*Server) GetClusterStatus ¶
GetClusterStatus gets cluster status.
func (*Server) GetClusterVersion ¶
GetClusterVersion returns the version of cluster.
func (*Server) GetControllerConfig ¶
func (s *Server) GetControllerConfig() *rm_server.ControllerConfig
GetControllerConfig gets the resource manager controller config.
func (*Server) GetEndpoints ¶
GetEndpoints returns the etcd endpoints for outer use.
func (*Server) GetExternalTS ¶
GetExternalTS returns external timestamp.
func (*Server) GetGRPCRateLimitConfig ¶
func (s *Server) GetGRPCRateLimitConfig() *config.GRPCRateLimitConfig
GetGRPCRateLimitConfig gets the rate limit config information.
func (*Server) GetGRPCRateLimiter ¶
func (s *Server) GetGRPCRateLimiter() *ratelimit.Controller
GetGRPCRateLimiter is used to get rate limiter
func (*Server) GetGlobalTSOAllocator ¶
GetGlobalTSOAllocator return global tso allocator It only is used for test.
func (*Server) GetHBStreams ¶
func (s *Server) GetHBStreams() *hbstream.HeartbeatStreams
GetHBStreams returns the heartbeat streams.
func (*Server) GetHTTPClient ¶
GetHTTPClient returns builtin http client.
func (*Server) GetHandler ¶
GetHandler returns the handler for API.
func (*Server) GetHistoryHotRegionStorage ¶
func (s *Server) GetHistoryHotRegionStorage() *storage.HotRegionStorage
GetHistoryHotRegionStorage returns the backend storage of historyHotRegion.
func (*Server) GetKeyspaceConfig ¶
func (s *Server) GetKeyspaceConfig() *config.KeyspaceConfig
GetKeyspaceConfig gets the keyspace config information.
func (*Server) GetKeyspaceGroupManager ¶
func (s *Server) GetKeyspaceGroupManager() *keyspace.GroupManager
GetKeyspaceGroupManager returns the keyspace group manager of server.
func (*Server) GetKeyspaceManager ¶
GetKeyspaceManager returns the keyspace manager of server.
func (*Server) GetLabelProperty ¶
func (s *Server) GetLabelProperty() config.LabelPropertyConfig
GetLabelProperty returns the whole label property config.
func (*Server) GetLeaderLease ¶
GetLeaderLease returns the leader lease.
func (*Server) GetLeaderListenUrls ¶
GetLeaderListenUrls gets service endpoints from the leader in election group.
func (*Server) GetMaxConcurrentTSOProxyStreamings ¶
GetMaxConcurrentTSOProxyStreamings returns the max concurrent TSO proxy streamings. If the value is negative, there is no limit.
func (*Server) GetMaxResetTSGap ¶
GetMaxResetTSGap gets the max gap to reset the tso.
func (*Server) GetMember ¶
func (s *Server) GetMember() *member.EmbeddedEtcdMember
GetMember returns the member of server.
func (*Server) GetMemberInfo ¶
GetMemberInfo returns the server member information.
func (*Server) GetMembers ¶
GetMembers returns PD server list.
func (*Server) GetMetaRegions ¶
GetMetaRegions gets meta regions from cluster.
func (*Server) GetMicroServiceConfig ¶
func (s *Server) GetMicroServiceConfig() *config.MicroServiceConfig
GetMicroServiceConfig gets the micro service config information.
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) GetRaftCluster ¶
func (s *Server) GetRaftCluster() *cluster.RaftCluster
GetRaftCluster gets Raft cluster. If cluster has not been bootstrapped, return nil.
func (*Server) GetRateLimitConfig ¶
func (s *Server) GetRateLimitConfig() *config.RateLimitConfig
GetRateLimitConfig gets the rate limit config information.
func (*Server) GetRegions ¶
func (s *Server) GetRegions() []*core.RegionInfo
GetRegions gets regions from cluster.
func (*Server) GetReplicationConfig ¶
func (s *Server) GetReplicationConfig() *sc.ReplicationConfig
GetReplicationConfig get the replication config.
func (*Server) GetReplicationModeConfig ¶
func (s *Server) GetReplicationModeConfig() *config.ReplicationModeConfig
GetReplicationModeConfig returns the replication mode config.
func (*Server) GetSafePointV2Manager ¶
func (s *Server) GetSafePointV2Manager() *gc.SafePointV2Manager
GetSafePointV2Manager returns the safe point v2 manager of server.
func (*Server) GetScheduleConfig ¶
func (s *Server) GetScheduleConfig() *sc.ScheduleConfig
GetScheduleConfig gets the balance config information.
func (*Server) GetServerOption ¶
func (s *Server) GetServerOption() *config.PersistOptions
GetServerOption gets the option of the server.
func (*Server) GetServiceAuditBackendLabels ¶
func (s *Server) GetServiceAuditBackendLabels(serviceLabel string) *audit.BackendLabels
GetServiceAuditBackendLabels returns audit backend labels by serviceLabel
func (*Server) GetServiceLabels ¶
func (s *Server) GetServiceLabels(serviceLabel string) []apiutil.AccessPath
GetServiceLabels returns ApiAccessPaths by given service label TODO: this function will be used for updating api rate limit config
func (*Server) GetServiceMiddlewareConfig ¶
func (s *Server) GetServiceMiddlewareConfig() *config.ServiceMiddlewareConfig
GetServiceMiddlewareConfig gets the service middleware config information.
func (*Server) GetServiceMiddlewarePersistOptions ¶
func (s *Server) GetServiceMiddlewarePersistOptions() *config.ServiceMiddlewarePersistOptions
GetServiceMiddlewarePersistOptions returns the service middleware persist option.
func (*Server) GetServicePrimaryAddr ¶
GetServicePrimaryAddr returns the primary address for a given service. Note: This function will only return primary address without judging if it's alive.
func (*Server) GetServiceRateLimiter ¶
func (s *Server) GetServiceRateLimiter() *ratelimit.Controller
GetServiceRateLimiter is used to get rate limiter
func (*Server) GetStorage ¶
GetStorage returns the backend storage of server.
func (*Server) GetTLSConfig ¶
GetTLSConfig get the security config.
func (*Server) GetTSOAllocatorManager ¶
func (s *Server) GetTSOAllocatorManager() *tso.AllocatorManager
GetTSOAllocatorManager returns the manager of TSO Allocator.
func (*Server) GetTSOProxyRecvFromClientTimeout ¶
GetTSOProxyRecvFromClientTimeout returns timeout value for TSO proxy receiving from the client.
func (*Server) GetTSOSaveInterval ¶
GetTSOSaveInterval returns TSO save interval.
func (*Server) GetTSOUpdatePhysicalInterval ¶
GetTSOUpdatePhysicalInterval returns TSO update physical interval.
func (*Server) IsAPIServiceMode ¶
IsAPIServiceMode return whether the server is in API service mode.
func (*Server) IsGRPCServiceLabelExist ¶
IsGRPCServiceLabelExist returns if the service label exists
func (*Server) IsInRateLimitAllowList ¶
IsInRateLimitAllowList returns whether given service label is in allow lost
func (*Server) IsLocalTSOEnabled ¶
IsLocalTSOEnabled returns if the local TSO is enabled.
func (*Server) IsServiceIndependent ¶
IsServiceIndependent returns whether the service is independent.
func (*Server) IsServing ¶
IsServing returns whether the server is the leader if there is embedded etcd, or the primary otherwise.
func (*Server) IsSnapshotRecovering ¶
IsSnapshotRecovering check whether recovering-mark marked
func (*Server) IsTTLConfigExist ¶
IsTTLConfigExist returns true if the ttl config is existed for a given config.
func (*Server) LoopContext ¶
LoopContext returns the loop context of server.
func (*Server) MarkSnapshotRecovering ¶
MarkSnapshotRecovering mark pd that we're recovering tikv will get this state during BR EBS restore. we write this info into etcd for simplicity, the key only stays inside etcd temporary during BR EBS restore in which period the cluster is not able to serve request. and is deleted after BR EBS restore is done.
func (*Server) PersistFile ¶
PersistFile saves a file in DataDir.
func (*Server) RecoverAllocID ¶
RecoverAllocID recover alloc id. set current base id to input id
func (*Server) ReplicateFileToMember ¶
func (s *Server) ReplicateFileToMember(ctx context.Context, member *pdpb.Member, name string, data []byte) error
ReplicateFileToMember is used to synchronize state to a member. Each member will write `data` to a local file named `name`. For security reason, data should be in JSON format.
func (*Server) SaveTTLConfig ¶
SaveTTLConfig save ttl config
func (*Server) SetAuditConfig ¶
func (s *Server) SetAuditConfig(cfg config.AuditConfig) error
SetAuditConfig sets the audit config.
func (*Server) SetClusterVersion ¶
SetClusterVersion sets the version of cluster.
func (*Server) SetEnableLocalTSO ¶
SetEnableLocalTSO sets enable-local-tso flag of Server. This function only for test.
func (*Server) SetExternalTS ¶
SetExternalTS returns external timestamp.
func (*Server) SetGRPCRateLimitConfig ¶
func (s *Server) SetGRPCRateLimitConfig(cfg config.GRPCRateLimitConfig) error
SetGRPCRateLimitConfig sets the rate limit config.
func (*Server) SetKeyspaceConfig ¶
func (s *Server) SetKeyspaceConfig(cfg config.KeyspaceConfig) error
SetKeyspaceConfig sets the keyspace config information.
func (*Server) SetKeyspaceManager ¶
SetKeyspaceManager sets the keyspace manager of server. Note: it is only used for test.
func (*Server) SetLabelProperty ¶
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 ¶
SetLogLevel sets log level.
func (*Server) SetMicroServiceConfig ¶
func (s *Server) SetMicroServiceConfig(cfg config.MicroServiceConfig) error
SetMicroServiceConfig sets the micro service config information.
func (*Server) SetPDServerConfig ¶
func (s *Server) SetPDServerConfig(cfg config.PDServerConfig) error
SetPDServerConfig sets the server config.
func (*Server) SetRateLimitConfig ¶
func (s *Server) SetRateLimitConfig(cfg config.RateLimitConfig) error
SetRateLimitConfig sets the rate limit config.
func (*Server) SetReplicationConfig ¶
func (s *Server) SetReplicationConfig(cfg sc.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 sc.ScheduleConfig) error
SetScheduleConfig sets the balance config information. This function is exported to be used by the API.
func (*Server) SetServiceAuditBackendForHTTP ¶
SetServiceAuditBackendForHTTP is used to register service audit config for HTTP.
func (*Server) SetServiceAuditBackendLabels ¶
SetServiceAuditBackendLabels is used to add audit backend labels for service by service label
func (*Server) SetServicePrimaryAddr ¶
SetServicePrimaryAddr sets the primary address directly. Note: This function is only used for test.
func (*Server) SetStorage ¶
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 ¶
StartTimestamp returns the start timestamp of this server
func (*Server) UnmarkSnapshotRecovering ¶
UnmarkSnapshotRecovering unmark recovering mark
func (*Server) UpdateGRPCRateLimit ¶
UpdateGRPCRateLimit is used to update gRPC rate-limit config which will overwrite limiter-config
func (*Server) UpdateGRPCRateLimitConfig ¶
func (s *Server) UpdateGRPCRateLimitConfig(key, label string, value ratelimit.DimensionConfig) error
UpdateGRPCRateLimitConfig is used to update rate-limit config which will reserve old limiter-config
func (*Server) UpdateGRPCServiceRateLimiter ¶
func (s *Server) UpdateGRPCServiceRateLimiter(serviceLabel string, opts ...ratelimit.Option) ratelimit.UpdateStatus
UpdateGRPCServiceRateLimiter is used to update RateLimiter
func (*Server) UpdateRateLimit ¶
UpdateRateLimit is used to update rate-limit config which will overwrite limiter-config
func (*Server) UpdateRateLimitConfig ¶
func (s *Server) UpdateRateLimitConfig(key, label string, value ratelimit.DimensionConfig) error
UpdateRateLimitConfig is used to update rate-limit config which will reserve old limiter-config
func (*Server) UpdateServiceRateLimiter ¶
func (s *Server) UpdateServiceRateLimiter(serviceLabel string, opts ...ratelimit.Option) ratelimit.UpdateStatus
UpdateServiceRateLimiter is used to update RateLimiter